This version introduces support for ES6 minification through
Please note this is a major version update of the plugin, which includes significantly updated versions of
uglify-es (v3.0.21) and
clean-css (v4.1.4) npm packages. Options APIs of both packages have changed massively, please update your existing code accordingly, or use previous version of this package (v0.2.1).
Install package with NPM and add it to your development dependencies:
npm install --save-dev gulp-minify-inline
var minifyInline = ;gulp;
Need a bit more control?
var minifyInline = ;var options =js:output:comments: truejsSelector: 'script[type!="text/x-handlebars-template"]'css:level: 1: specialComments: 0cssSelector: 'style[data-do-not-minify!="true"]';gulp;
Right now the following options are supported:
jscontains parameters to pass to
UglifyJS2.minify()(for documetation refer to the project homepage). Set it to
falseto disable JS uglification globally. Please note that the plugin defaults
truein order to combat XSS (contributed by @TimothyGu). This is quite useful in general but you might want to re-set it to
falseexplicitly in (an extremely rare) case it breaks things for you.
jsSelectorpassed to cheerio as a selector for script tags. This allows you to avoid uglification of certain script tags (e.g. ones containing templates or other non-JS payload). Default:
csscontains parameters to pass to clean-css (for documetation refer to the project homepage). Set it to
falseto disable CSS minification globally.
cssSelectorpassed to cheerio as a selector for style tags. This allows you to avoid minification of certain style tags. Default: