Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
rollup-plugin-minify-html-literals
Advanced tools
Rollup plugin to minify HTML template literal strings
Uses minify-html-literals to minify HTML and CSS markup inside JavaScript template literal strings.
import babel from 'rollup-plugin-babel';
import minifyHTML from 'rollup-plugin-minify-html-literals';
import { uglify } from 'rollup-plugin-uglify';
export default {
entry: 'index.js',
dest: 'dist/index.js',
plugins: [
minifyHTML(),
// Order plugin before transpilers and other minifiers
babel(),
uglify()
]
};
By default, this will minify any tagged template literal string whose tag contains "html" or "css" (case insensitive). Additional options may be specified to control what templates should be minified.
export default {
entry: 'index.js',
dest: 'dist/index.js',
plugins: [
minifyHTML({
// minimatch of files to minify
include: [],
// minimatch of files not to minify
exclude: [],
// set to `true` to abort bundling on a minification error
failOnError: false,
// minify-html-literals options
// https://www.npmjs.com/package/minify-html-literals#options
options: null,
// Advanced Options
// Override minify-html-literals function
minifyHTMLLiterals: null,
// Override rollup-pluginutils filter from include/exclude
filter: null
})
]
};
import minifyHTML from 'rollup-plugin-minify-html-literals';
import { defaultShouldMinify } from 'minify-html-literals';
export default {
entry: 'index.js',
dest: 'dist/index.js',
plugins: [
minifyHTML({
options: {
shouldMinify(template) {
return (
defaultShouldMinify(template) ||
template.parts.some(part => {
// Matches Polymer templates that are not tagged
return (
part.text.includes('<style') ||
part.text.includes('<dom-module')
);
})
);
}
}
})
]
};
FAQs
Rollup plugin to minify HTML template literal strings
The npm package rollup-plugin-minify-html-literals receives a total of 10,026 weekly downloads. As such, rollup-plugin-minify-html-literals popularity was classified as popular.
We found that rollup-plugin-minify-html-literals 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.