html-webpack-css-inliner-plugin
v1.0.0
Published
Inline css styles using Webpack, HTMLWebpackPlugin and Juice
Downloads
5
Maintainers
Readme
CSS Inliner Extension for the HTMLWebpackPlugin
This package extends the html-webpack-plugin functionality by inlining existing styles to HTML elements using juice.
You might want to use this to automate email generation with Webpack 5.
The following input provided by the HTMLWebpackPlugin:
<style>span {display: block;}</style>
will result in
<span style="display: block;"></span>
Installation
Install the plugin with npm:
$ npm install --save-dev html-webpack-css-inliner-plugin
Install the plugin with yarn:
$ yarn add --dev html-webpack-css-inliner-plugin
Basic Usage
Require the plugin in your webpack config:
var HtmlWebpackCssInlinerPlugin = require('html-webpack-css-inliner-plugin');
Add the plugin to your webpack config as follows:
{
...
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackCssInlinerPlugin()
]
...
}