
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
gulp-minify-inline
Advanced tools
gulp-minify-inline is a gulp plugin that minifies inline JS and CSS. Works best with gulp-minify-html.
Uses cheerio to parse HTML, terser to minify JS and clean-css to minify CSS.
Install package with NPM and add it to your development dependencies:
npm install --save-dev gulp-minify-inline
Straightforward way:
var minifyInline = require('gulp-minify-inline');
gulp.task('minify-inline', function() {
gulp.src('src/*.html')
.pipe(minifyInline())
.pipe(gulp.dest('dist/'))
});
Need a bit more control?
var minifyInline = require('gulp-minify-inline');
var options = {
js: {
output: {
comments: true
}
},
jsSelector: 'script[type!="text/x-handlebars-template"]',
css: {
level: {1: {specialComments: 0}}
},
cssSelector: 'style[data-do-not-minify!="true"]'
};
gulp.task('minify-inline', function() {
gulp.src('src/*.html')
.pipe(minifyInline(options))
.pipe(gulp.dest('dist/'))
});
Right now the following options are supported:
js contains parameters to pass to terser.minify() (for documetation refer to the project homepage). Set it to false to disable JS minification globally. Please note that the plugin defaults js.output.inline_script to true in order to combat XSS (contributed by @TimothyGu). This is quite useful in general but you might want to re-set it to false explicitly in (an extremely rare) case it breaks things for you.jsSelector is passed to cheerio as a selector for script tags. This allows you to avoid minification of certain script tags (e.g. ones containing templates or other non-JS payload). Default: 'script'.css contains parameters to pass to clean-css (for documetation refer to the project homepage). Set it to false to disable CSS minification globally.cssSelector is passed to cheerio as a selector for style tags. This allows you to avoid minification of certain style tags. Default: 'style'.FAQs
Gulp plugin to uglify inline JS and minify inline CSS
The npm package gulp-minify-inline receives a total of 2,082 weekly downloads. As such, gulp-minify-inline popularity was classified as popular.
We found that gulp-minify-inline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.