An extension plugin for the webpack plugin html-webpack-plugin.It allows you to embed css and ES6 or legacy-js sources inline as you choose.
If you don't use modern mode
, html-webpack-inline-source-plugin maybe a better choice.
Required node 6 or higher.
Install:
$ npm install --save-dev webpack-inline-modern-source-plugin
Require the plugin in your webpack config:
var WebpackInlineMordernSourcePlugin = require('webpack-inline-modern-source-plugin');
Add the plugin to your webpack config:
plugins: [
new HtmlWebpackPlugin({
inlineSource: '.(js|css)$'
}),
new WebpackInlineMordernSourcePlugin()
]
It will embed all js and css sources inline. If you want to embed modern chunks or legacy chunks only, use inlineLegacy
or inlineModern
:
plugins: [
new HtmlWebpackPlugin({
inlineSource: '.(js|css)$',
inlineLegacy: false, // default value: true
inlineModern: true, // default value: true
}),
new WebpackInlineMordernSourcePlugin()
]