💝 Embed javascript and css source with size limit inside of html when using webpack
npm install html-webpack-inline-size-plugin --save-dev
or
yarn add html-webpack-inline-size-plugin -D
- specify
inlineSize
option inhtml-webpack-plugin
- use
html-webpack-inline-size-plugin
the option inlineSource
used by html-webpack-inline-source-plugin
is also supported
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineSizePlugin = require('html-webpack-inline-size-plugin');
const webpackConfig = {
// ...
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: 'index.html',
// other config options
inlineSize: 5 * 1024 // files that size is smaller than 5kb will be inline in html
}),
new HtmlWebpackInlineSizePlugin()
]
}
MIT