UNPKG

style-ext-html-webpack-plugin-webpack-4

Version:

adapt style-ext-html-webpack for webpack 4 to extract css to inline style

31 lines (29 loc) 964 B
# style-ext-html-webpack-plugin for webpack 4 This plugin fixed problems for [style-ext-html-webpack-plugin](https://github.com/liyincheng/style-ext-html-webpack-plugin) whoes current version does not supporte webpack 4. The funtionality is to extract CSS file in inline style. ```bash npm i --save-dev style-ext-html-webpack-plugin-webpack-4 ``` ##Usage ```javascript const HtmlWebpackPlugin = require('html-webpack-plugin'); const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin-webpack-4'); new HtmlWebpackPlugin({ plugins: [ new HtmlWebpackPlugin({ filename: 'test.html', template: 'src/assets/test.html' }), // this one should be placed after HtmlWebpackPlugin new StyleExtHtmlWebpackPlugin() ] }); ``` The output will like: ```html <!DOCType html> <html> <head> <!--transform inline link tag to style tag--> <style>body,h1,h2{margin:0;padding:0}</style> </head> ```