Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@parcel/transformer-posthtml
Advanced tools
@parcel/transformer-posthtml is a Parcel transformer plugin that allows you to use PostHTML to transform HTML files. PostHTML is a tool for transforming HTML/XML with JavaScript plugins, enabling you to modify HTML structure, add or remove elements, and more.
HTML Transformation
This feature allows you to transform HTML files using PostHTML plugins. By adding the transformer to your Parcel bundler configuration, you can apply various PostHTML plugins to modify your HTML files during the build process.
module.exports = function (bundler) {
bundler.addAssetType('html', require.resolve('@parcel/transformer-posthtml'));
};
Custom PostHTML Plugins
You can add custom PostHTML plugins to the Parcel bundler configuration. This allows you to extend the functionality of the HTML transformation process by using custom plugins that perform specific tasks.
module.exports = function (bundler) {
bundler.addAssetType('html', require.resolve('@parcel/transformer-posthtml'));
bundler.addPostHTMLPlugin(require('posthtml-custom-plugin'));
};
HTML Minification
This feature allows you to minify HTML files using PostHTML plugins like 'posthtml-minifier'. By adding the minifier plugin to the configuration, you can reduce the size of your HTML files by removing unnecessary whitespace and comments.
module.exports = function (bundler) {
bundler.addAssetType('html', require.resolve('@parcel/transformer-posthtml'));
bundler.addPostHTMLPlugin(require('posthtml-minifier')({ collapseWhitespace: true }));
};
PostHTML is the core library for transforming HTML/XML with JavaScript plugins. It provides a flexible API for creating custom plugins and applying them to HTML files. Compared to @parcel/transformer-posthtml, PostHTML is more low-level and requires manual setup for integration with build tools.
html-webpack-plugin is a plugin for Webpack that simplifies the creation of HTML files to serve your bundles. It can be used to inject scripts, minify HTML, and more. While it offers some similar functionalities, it is specific to Webpack and does not use PostHTML for transformations.
gulp-posthtml is a Gulp plugin that allows you to use PostHTML in your Gulp build process. It provides similar functionalities for transforming HTML files using PostHTML plugins but is designed to work within the Gulp ecosystem rather than Parcel.
FAQs
Unknown package
We found that @parcel/transformer-posthtml demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.