diff --git a/bin/build.ts b/bin/build.ts index 0b5fb4e..3d6896f 100755 --- a/bin/build.ts +++ b/bin/build.ts @@ -25,6 +25,11 @@ export default async function run(args?: string[]): Promise { type: "string", default: "./" }, + minify: { + type: "boolean", + // Default to true; use --no-minify to disable + default: true + }, template: { type: "string" }, @@ -45,6 +50,7 @@ export default async function run(args?: string[]): Promise { --template path to the HTML template -o, --out path to the output directory (relative to root) --base serving base path; defaults to ./ + --no-minify disable JS/CSS minification --empty whether to empty the output directory before building -h, --help show this message `); @@ -57,6 +63,8 @@ export default async function run(args?: string[]): Promise { root: values.root, base: values.base, build: { + minify: values.minify ? "esbuild" : false, + cssMinify: values.minify ? "esbuild" : false, outDir: values.out, emptyOutDir: values.empty, rollupOptions: { diff --git a/package.json b/package.json index fde535c..69e70a9 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "notebooks": "tsx bin/notebooks.ts", "download": "tsx bin/notebooks.ts download", "docs:preview": "tsx --watch bin/notebooks.ts preview --root docs --template docs/observable.tmpl", + "docs:build-dev": "tsx bin/notebooks.ts build --root docs --template docs/observable.tmpl --no-minify -- $(find docs -path 'docs/.observable' -prune -o -name '*.html' -print)", "docs:build": "tsx bin/notebooks.ts build --root docs --template docs/observable.tmpl -- $(find docs -path 'docs/.observable' -prune -o -name '*.html' -print)" }, "bin": {