env-inject-body-webpack-plugin
v1.0.3
Published
Webpack plugin that injects a custom string into the end of the body of html-webpack-plugin output according to the environment.
Downloads
3
Maintainers
Readme
env-inject-body-webpack-plugin
A HTML Webpack Plugin for injecting a custom string into the end of body of html-webpack-plugin output according to the environment. (inspired by inject-body-webpack-plugin)
Installation
npm i -D env-inject-body-webpack-plugin
Example
Input
webpack.config.js
import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyPlugin from "env-inject-body-webpack-plugin"
export default {
mode: 'development',
plugins: [
new HtmlWebpackPlugin(),
new InjectBodyPlugin({
content: '<script src="index.js"></script>',
env: ["development"]
}),
],
}
Output
index.html
<html><body><script src="index.js"></script></body></html>