From 0774cec95ef250c180022dca374d9f68084d1f34 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Mon, 19 Dec 2016 15:58:02 -0800 Subject: [PATCH 1/7] Cleanup how optimize streams work, in preparation for babel stream --- src/build/build.ts | 54 ++++++++++++++++------------------- src/build/optimize-streams.ts | 31 +++++++++++++++++++- src/commands/build.ts | 36 ++++++++++++++++------- 3 files changed, 79 insertions(+), 42 deletions(-) diff --git a/src/build/build.ts b/src/build/build.ts index 45668420..653eaf3a 100644 --- a/src/build/build.ts +++ b/src/build/build.ts @@ -18,10 +18,11 @@ import * as path from 'path'; import * as logging from 'plylog'; import {dest} from 'vinyl-fs'; + import mergeStream = require('merge-stream'); import {PolymerProject, addServiceWorker, forkStream, SWConfig} from 'polymer-build'; -import {InlineCSSOptimizeStream, JSOptimizeStream, CSSOptimizeStream, HTMLOptimizeStream} from './optimize-streams'; +import {getOptimizeStreams} from './optimize-streams'; import {ProjectConfig} from 'polymer-project-config'; import {PrefetchTransform} from './prefetch'; @@ -36,9 +37,8 @@ const bundledBuildDirectory = 'build/bundled'; export interface BuildOptions { swPrecacheConfig?: string; insertDependencyLinks?: boolean; - // TODO(fks) 07-21-2016: Fully complete these with available options - html?: {collapseWhitespace?: boolean; removeComments?: boolean}; - css?: {stripWhitespace?: boolean}; + html?: {minify: boolean}; + css?: {minify: boolean}; js?: {minify?: boolean}; } @@ -51,12 +51,10 @@ export async function build( `Additional dependency links will be inserted into application`); } - // mix in optimization options from build command - // TODO: let this be set by the user - let optimizeOptions = { - html: Object.assign({removeComments: true}, options.html), - css: Object.assign({stripWhitespace: true}, options.css), - js: Object.assign({minify: true}, options.js), + const optimizeOptions = { + htmlMinify: options.html && options.html.minify, + cssMinify: options.css && options.css.minify, + jsMinify: options.js && options.js.minify, }; logger.info(`Preparing build...`); @@ -65,28 +63,24 @@ export async function build( logger.info(`Building application...`); logger.debug(`Reading source files...`); - let sourcesStream = - polymerProject.sources() - .pipe(polymerProject.splitHtml()) - .pipe(gulpif(/\.js$/, new JSOptimizeStream(optimizeOptions.js))) - .pipe(gulpif(/\.css$/, new CSSOptimizeStream(optimizeOptions.css))) - // TODO(fks): Remove this InlineCSSOptimizeStream stream once CSS - // is properly being isolated by splitHtml() & rejoinHtml(). - .pipe(gulpif(/\.html$/, new InlineCSSOptimizeStream(optimizeOptions.css))) - .pipe(gulpif(/\.html$/, new HTMLOptimizeStream(optimizeOptions.html))) - .pipe(polymerProject.rejoinHtml()); + const sourcesStream = [].concat.apply([], [ + polymerProject.sources(), + polymerProject.splitHtml(), + getOptimizeStreams(optimizeOptions), + polymerProject.rejoinHtml() + ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { + return a.pipe(b); + }); logger.debug(`Reading dependencies...`); - let depsStream = - polymerProject.dependencies() - .pipe(polymerProject.splitHtml()) - .pipe(gulpif(/\.js$/, new JSOptimizeStream(optimizeOptions.js))) - .pipe(gulpif(/\.css$/, new CSSOptimizeStream(optimizeOptions.css))) - // TODO(fks): Remove this InlineCSSOptimizeStream stream once CSS - // is properly being isolated by splitHtml() & rejoinHtml(). - .pipe(gulpif(/\.html$/, new InlineCSSOptimizeStream(optimizeOptions.css))) - .pipe(gulpif(/\.html$/, new HTMLOptimizeStream(optimizeOptions.html))) - .pipe(polymerProject.rejoinHtml()); + const depsStream = [].concat.apply([], [ + polymerProject.dependencies(), + polymerProject.splitHtml(), + getOptimizeStreams(optimizeOptions), + polymerProject.rejoinHtml() + ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { + return a.pipe(b); + }); let buildStream = mergeStream(sourcesStream, depsStream); diff --git a/src/build/optimize-streams.ts b/src/build/optimize-streams.ts index f9693257..0ceb2bda 100644 --- a/src/build/optimize-streams.ts +++ b/src/build/optimize-streams.ts @@ -13,12 +13,12 @@ */ import * as cssSlam from 'css-slam'; +import * as gulpif from 'gulp-if'; import {minify as htmlMinify, Options as HTMLMinifierOptions} from 'html-minifier'; import * as logging from 'plylog'; import {Transform} from 'stream'; import {minify as uglify, MinifyOptions as UglifyOptions} from 'uglify-js'; - // TODO(fks) 09-22-2016: Latest npm type declaration resolves to a non-module // entity. Upgrade to proper JS import once compatible .d.ts file is released, // or consider writing a custom declaration in the `custom_typings/` folder. @@ -30,6 +30,11 @@ export type FileCB = (error?: any, file?: File) => void; export type CSSOptimizeOptions = { stripWhitespace?: boolean; }; +export interface OptimizeOptions { + htmlMinify?: HTMLMinifierOptions; + cssMinify?: CSSOptimizeOptions; + jsMinify?: UglifyOptions; +}; /** * GenericOptimizeStream is a generic optimization stream. It can be extended @@ -132,3 +137,27 @@ export class HTMLOptimizeStream extends GenericOptimizeStream { super('html-minify', htmlMinify, options); } } + +/** + * Returns an array of optimization streams to use in your build, based on the + * OptimizeOptions given. + */ +export function getOptimizeStreams(optimizeOptions: OptimizeOptions) { + let streams = []; + + // add optimizers + if (optimizeOptions.htmlMinify) { + streams.push(gulpif(/\.html$/, new HTMLOptimizeStream({collapseWhitespace: true, removeComments: true}))); + } + if (optimizeOptions.cssMinify) { + streams.push(gulpif(/\.css$/, new CSSOptimizeStream({stripWhitespace: true}))); + // TODO(fks): Remove this InlineCSSOptimizeStream stream once CSS + // is properly being isolated by splitHtml() & rejoinHtml(). + streams.push(gulpif(/\.html$/, new InlineCSSOptimizeStream({stripWhitespace: true}))); + } + if (optimizeOptions.jsMinify) { + streams.push(gulpif(/\.js$/, new JSOptimizeStream({fromString: true}))); + } + + return streams; +}; \ No newline at end of file diff --git a/src/commands/build.ts b/src/commands/build.ts index 6f4f0239..c862fb98 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -31,6 +31,21 @@ export class BuildCommand implements Command { description = 'Builds an application-style project'; args = [ + { + name: 'js-minify', + type: Boolean, + description: 'minify inlined and external JavaScript.' + }, + { + name: 'css-minify', + type: Boolean, + description: 'minify inlined and external CSS.' + }, + { + name: 'html-minify', + type: Boolean, + description: 'minify HTML by removing comments and whitespace.' + }, { name: 'sw-precache-config', defaultValue: 'sw-precache-config.js', @@ -44,11 +59,6 @@ export class BuildCommand implements Command { 'additional `` tags into ' + 'entrypoint and `` tags into fragments and shell.' }, - { - name: 'html.collapseWhitespace', - type: Boolean, - description: 'Collapse whitespace in HTML files' - } ]; run(options: CommandOptions, config: ProjectConfig): Promise { @@ -58,13 +68,17 @@ export class BuildCommand implements Command { let buildOptions: BuildOptions = { swPrecacheConfig: options['sw-precache-config'], insertDependencyLinks: options['insert-dependency-links'], - html: {}, - css: {}, - js: {}, + html: { + minify: !!options['html-minify'], + }, + css: { + minify: !!options['css-minify'], + }, + js: { + minify: !!options['js-minify'], + }, }; - if (options['html.collapseWhitespace']) { - buildOptions.html!.collapseWhitespace = true; - } + logger.debug('building with options', buildOptions); if (options['env'] && options['env'].build) { From 1d8868f1c478af3ce0069722f10910d3909aa640 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 20 Dec 2016 14:34:44 -0800 Subject: [PATCH 2/7] death to lets --- src/build/optimize-streams.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/build/optimize-streams.ts b/src/build/optimize-streams.ts index 0ceb2bda..ffbcf38c 100644 --- a/src/build/optimize-streams.ts +++ b/src/build/optimize-streams.ts @@ -24,7 +24,7 @@ import {minify as uglify, MinifyOptions as UglifyOptions} from 'uglify-js'; // or consider writing a custom declaration in the `custom_typings/` folder. import File = require('vinyl'); -let logger = logging.getLogger('cli.build.optimize-streams'); +const logger = logging.getLogger('cli.build.optimize-streams'); export type FileCB = (error?: any, file?: File) => void; export type CSSOptimizeOptions = { @@ -82,11 +82,11 @@ export class JSOptimizeStream extends GenericOptimizeStream { // uglify is special, in that it returns an object with a code property // instead of just a code string. We create a compliant optimizer here // that returns a string instead. - let uglifyOptimizer = (contents: string, options: UglifyOptions) => { + const uglifyOptimizer = (contents: string, options: UglifyOptions) => { return uglify(contents, options).code; }; // We automatically add the fromString option because it is required. - let uglifyOptions = Object.assign({fromString: true}, options); + const uglifyOptions = Object.assign({fromString: true}, options); super('uglify-js', uglifyOptimizer, uglifyOptions); } } @@ -143,7 +143,7 @@ export class HTMLOptimizeStream extends GenericOptimizeStream { * OptimizeOptions given. */ export function getOptimizeStreams(optimizeOptions: OptimizeOptions) { - let streams = []; + const streams = []; // add optimizers if (optimizeOptions.htmlMinify) { From dc7568f0a9e86d31cb1568d3bd7f125ffd6e4cc5 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 20 Dec 2016 14:38:19 -0800 Subject: [PATCH 3/7] redeisn optimize interface --- src/build/build.ts | 18 +++++------------- src/build/optimize-streams.ts | 15 ++++++++------- src/commands/build.ts | 18 ++++++++++-------- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/build/build.ts b/src/build/build.ts index 653eaf3a..4365c575 100644 --- a/src/build/build.ts +++ b/src/build/build.ts @@ -22,7 +22,7 @@ import {dest} from 'vinyl-fs'; import mergeStream = require('merge-stream'); import {PolymerProject, addServiceWorker, forkStream, SWConfig} from 'polymer-build'; -import {getOptimizeStreams} from './optimize-streams'; +import {OptimizeOptions, getOptimizeStreams} from './optimize-streams'; import {ProjectConfig} from 'polymer-project-config'; import {PrefetchTransform} from './prefetch'; @@ -37,10 +37,8 @@ const bundledBuildDirectory = 'build/bundled'; export interface BuildOptions { swPrecacheConfig?: string; insertDependencyLinks?: boolean; - html?: {minify: boolean}; - css?: {minify: boolean}; - js?: {minify?: boolean}; -} + optimize?: OptimizeOptions; +}; export async function build( options: BuildOptions, config: ProjectConfig): Promise { @@ -51,12 +49,6 @@ export async function build( `Additional dependency links will be inserted into application`); } - const optimizeOptions = { - htmlMinify: options.html && options.html.minify, - cssMinify: options.css && options.css.minify, - jsMinify: options.js && options.js.minify, - }; - logger.info(`Preparing build...`); await del([unbundledBuildDirectory, bundledBuildDirectory]); @@ -66,7 +58,7 @@ export async function build( const sourcesStream = [].concat.apply([], [ polymerProject.sources(), polymerProject.splitHtml(), - getOptimizeStreams(optimizeOptions), + getOptimizeStreams(options.optimize), polymerProject.rejoinHtml() ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { return a.pipe(b); @@ -76,7 +68,7 @@ export async function build( const depsStream = [].concat.apply([], [ polymerProject.dependencies(), polymerProject.splitHtml(), - getOptimizeStreams(optimizeOptions), + getOptimizeStreams(options.optimize), polymerProject.rejoinHtml() ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { return a.pipe(b); diff --git a/src/build/optimize-streams.ts b/src/build/optimize-streams.ts index ffbcf38c..15edb918 100644 --- a/src/build/optimize-streams.ts +++ b/src/build/optimize-streams.ts @@ -31,9 +31,9 @@ export type CSSOptimizeOptions = { stripWhitespace?: boolean; }; export interface OptimizeOptions { - htmlMinify?: HTMLMinifierOptions; - cssMinify?: CSSOptimizeOptions; - jsMinify?: UglifyOptions; + html?: {minify: boolean}; + css?: {minify: boolean}; + js?: {minify?: boolean}; }; /** @@ -142,20 +142,21 @@ export class HTMLOptimizeStream extends GenericOptimizeStream { * Returns an array of optimization streams to use in your build, based on the * OptimizeOptions given. */ -export function getOptimizeStreams(optimizeOptions: OptimizeOptions) { +export function getOptimizeStreams(options?: OptimizeOptions) { + options = options || {}; const streams = []; // add optimizers - if (optimizeOptions.htmlMinify) { + if (options.html && options.html.minify) { streams.push(gulpif(/\.html$/, new HTMLOptimizeStream({collapseWhitespace: true, removeComments: true}))); } - if (optimizeOptions.cssMinify) { + if (options.css && options.css.minify) { streams.push(gulpif(/\.css$/, new CSSOptimizeStream({stripWhitespace: true}))); // TODO(fks): Remove this InlineCSSOptimizeStream stream once CSS // is properly being isolated by splitHtml() & rejoinHtml(). streams.push(gulpif(/\.html$/, new InlineCSSOptimizeStream({stripWhitespace: true}))); } - if (optimizeOptions.jsMinify) { + if (options.js && options.js.minify) { streams.push(gulpif(/\.js$/, new JSOptimizeStream({fromString: true}))); } diff --git a/src/commands/build.ts b/src/commands/build.ts index c862fb98..34fd512d 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -68,14 +68,16 @@ export class BuildCommand implements Command { let buildOptions: BuildOptions = { swPrecacheConfig: options['sw-precache-config'], insertDependencyLinks: options['insert-dependency-links'], - html: { - minify: !!options['html-minify'], - }, - css: { - minify: !!options['css-minify'], - }, - js: { - minify: !!options['js-minify'], + optimize: { + html: { + minify: !!options['html-minify'], + }, + css: { + minify: !!options['css-minify'], + }, + js: { + minify: !!options['js-minify'], + }, }, }; From 5834a1467ca9f36fadb791f2c8da3c004abe7686 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 20 Dec 2016 16:01:45 -0800 Subject: [PATCH 4/7] pull stream piping into a helper function --- src/build/build.ts | 17 +++++++---------- src/build/optimize-streams.ts | 14 ++++++++++---- src/build/streams.ts | 16 ++++++++++++++++ src/commands/build.ts | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/build/build.ts b/src/build/build.ts index 4365c575..3058d9cc 100644 --- a/src/build/build.ts +++ b/src/build/build.ts @@ -26,7 +26,7 @@ import {OptimizeOptions, getOptimizeStreams} from './optimize-streams'; import {ProjectConfig} from 'polymer-project-config'; import {PrefetchTransform} from './prefetch'; -import {waitFor} from './streams'; +import {waitFor, pipeStreams} from './streams'; import {parsePreCacheConfig} from './sw-precache'; const logger = logging.getLogger('cli.build.build'); @@ -38,7 +38,8 @@ export interface BuildOptions { swPrecacheConfig?: string; insertDependencyLinks?: boolean; optimize?: OptimizeOptions; -}; +} +; export async function build( options: BuildOptions, config: ProjectConfig): Promise { @@ -55,24 +56,20 @@ export async function build( logger.info(`Building application...`); logger.debug(`Reading source files...`); - const sourcesStream = [].concat.apply([], [ + const sourcesStream = pipeStreams([ polymerProject.sources(), polymerProject.splitHtml(), getOptimizeStreams(options.optimize), polymerProject.rejoinHtml() - ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { - return a.pipe(b); - }); + ]); logger.debug(`Reading dependencies...`); - const depsStream = [].concat.apply([], [ + const depsStream = pipeStreams([ polymerProject.dependencies(), polymerProject.splitHtml(), getOptimizeStreams(options.optimize), polymerProject.rejoinHtml() - ]).reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { - return a.pipe(b); - }); + ]); let buildStream = mergeStream(sourcesStream, depsStream); diff --git a/src/build/optimize-streams.ts b/src/build/optimize-streams.ts index 15edb918..c2e99140 100644 --- a/src/build/optimize-streams.ts +++ b/src/build/optimize-streams.ts @@ -142,19 +142,25 @@ export class HTMLOptimizeStream extends GenericOptimizeStream { * Returns an array of optimization streams to use in your build, based on the * OptimizeOptions given. */ -export function getOptimizeStreams(options?: OptimizeOptions) { +export function getOptimizeStreams(options?: OptimizeOptions): + NodeJS.ReadWriteStream[] { options = options || {}; const streams = []; // add optimizers if (options.html && options.html.minify) { - streams.push(gulpif(/\.html$/, new HTMLOptimizeStream({collapseWhitespace: true, removeComments: true}))); + streams.push(gulpif( + /\.html$/, + new HTMLOptimizeStream( + {collapseWhitespace: true, removeComments: true}))); } if (options.css && options.css.minify) { - streams.push(gulpif(/\.css$/, new CSSOptimizeStream({stripWhitespace: true}))); + streams.push( + gulpif(/\.css$/, new CSSOptimizeStream({stripWhitespace: true}))); // TODO(fks): Remove this InlineCSSOptimizeStream stream once CSS // is properly being isolated by splitHtml() & rejoinHtml(). - streams.push(gulpif(/\.html$/, new InlineCSSOptimizeStream({stripWhitespace: true}))); + streams.push(gulpif( + /\.html$/, new InlineCSSOptimizeStream({stripWhitespace: true}))); } if (options.js && options.js.minify) { streams.push(gulpif(/\.js$/, new JSOptimizeStream({fromString: true}))); diff --git a/src/build/streams.ts b/src/build/streams.ts index 8aa641ee..cab13b58 100644 --- a/src/build/streams.ts +++ b/src/build/streams.ts @@ -30,3 +30,19 @@ export function waitForAll(streams: NodeJS.ReadableStream[]): Promise { return Promise.all(streams.map((s) => waitFor(s))); } + +type PipeStream = (NodeJS.ReadableStream|NodeJS.WritableStream| + NodeJS.ReadableStream[]|NodeJS.WritableStream[]); + +/** + * pipeStreams() takes in a collection streams and pipes them together, + * returning the last stream in the pipeline. Each element in the `streams` + * array must be either a stream, or an array of streams (see PipeStream). + * pipeStreams() will then flatten this array before piping them all together. + */ +export function pipeStreams(streams: PipeStream[]): NodeJS.ReadableStream { + return Array.prototype.concat.apply([], streams) + .reduce((a: NodeJS.ReadableStream, b: NodeJS.ReadWriteStream) => { + return a.pipe(b); + }); +} diff --git a/src/commands/build.ts b/src/commands/build.ts index 34fd512d..a245667e 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -13,13 +13,13 @@ */ import * as logging from 'plylog'; +import {ProjectConfig} from 'polymer-project-config'; // Only import type definitions here, otherwise this line will be included in // the JS output, triggering the entire build library & its dependencies to // be loaded and parsed. import {BuildOptions} from '../build/build'; -import {ProjectConfig} from 'polymer-project-config'; import {Command, CommandOptions} from './command'; let logger = logging.getLogger('cli.command.build'); From 6a3d803c34e901c6548105efbc954af500e16b95 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 20 Dec 2016 16:05:49 -0800 Subject: [PATCH 5/7] rollback cli dash-case naming --- src/commands/build.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/build.ts b/src/commands/build.ts index a245667e..333ccf8e 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -32,17 +32,17 @@ export class BuildCommand implements Command { args = [ { - name: 'js-minify', + name: 'js.minify', type: Boolean, description: 'minify inlined and external JavaScript.' }, { - name: 'css-minify', + name: 'css.minify', type: Boolean, description: 'minify inlined and external CSS.' }, { - name: 'html-minify', + name: 'html.minify', type: Boolean, description: 'minify HTML by removing comments and whitespace.' }, @@ -70,13 +70,13 @@ export class BuildCommand implements Command { insertDependencyLinks: options['insert-dependency-links'], optimize: { html: { - minify: !!options['html-minify'], + minify: !!options['html.minify'], }, css: { - minify: !!options['css-minify'], + minify: !!options['css.minify'], }, js: { - minify: !!options['js-minify'], + minify: !!options['js.minify'], }, }, }; From c63c4cefb149d16510af65c7e9ad7e745c56366d Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Thu, 12 Jan 2017 14:28:07 -0800 Subject: [PATCH 6/7] remove unused gulpif --- src/build/build.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/build/build.ts b/src/build/build.ts index 3cb21eda..46984bb4 100644 --- a/src/build/build.ts +++ b/src/build/build.ts @@ -13,7 +13,6 @@ */ import * as del from 'del'; -import * as gulpif from 'gulp-if'; import * as path from 'path'; import * as logging from 'plylog'; import {dest} from 'vinyl-fs'; From 2f4a91d0ff188a3e5e6ffcdbcf18ce9ecd912f27 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Thu, 12 Jan 2017 14:37:47 -0800 Subject: [PATCH 7/7] update buildoptions to match planned polymer.json options --- src/build/build.ts | 9 +++++---- src/commands/build.ts | 18 ++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/build/build.ts b/src/build/build.ts index 46984bb4..eaa967e0 100644 --- a/src/build/build.ts +++ b/src/build/build.ts @@ -32,15 +32,16 @@ const logger = logging.getLogger('cli.build.build'); const buildDirectory = 'build/'; -export interface BuildOptions { +export interface BuildOptions extends OptimizeOptions { swPrecacheConfig?: string; insertPrefetchLinks?: boolean; bundle?: boolean; - optimize?: OptimizeOptions; }; export async function build( options: BuildOptions, config: ProjectConfig): Promise { + const optimizeOptions: + OptimizeOptions = {css: options.css, js: options.js, html: options.html}; const polymerProject = new PolymerProject(config); const swPrecacheConfig = path.resolve( config.root, options.swPrecacheConfig || 'sw-precache-config.js'); @@ -52,7 +53,7 @@ export async function build( const sourcesStream = pipeStreams([ polymerProject.sources(), polymerProject.splitHtml(), - getOptimizeStreams(options.optimize), + getOptimizeStreams(optimizeOptions), polymerProject.rejoinHtml() ]); @@ -60,7 +61,7 @@ export async function build( const depsStream = pipeStreams([ polymerProject.dependencies(), polymerProject.splitHtml(), - getOptimizeStreams(options.optimize), + getOptimizeStreams(optimizeOptions), polymerProject.rejoinHtml() ]); diff --git a/src/commands/build.ts b/src/commands/build.ts index 914547be..0bf1c90f 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -77,16 +77,14 @@ export class BuildCommand implements Command { swPrecacheConfig: options['sw-precache-config'], insertPrefetchLinks: options['insert-prefetch-links'], bundle: options['bundle'], - optimize: { - html: { - minify: !!options['html-minify'], - }, - css: { - minify: !!options['css-minify'], - }, - js: { - minify: !!options['js-minify'], - }, + html: { + minify: !!options['html-minify'], + }, + css: { + minify: !!options['css-minify'], + }, + js: { + minify: !!options['js-minify'], }, };