Skip to content

tophat/inject-inline-html-webpack-plugin

Repository files navigation

Inject Inline Html Webpack Plugin

Continuous Integration codecov Maturity badge - level 2 GitHub license Slack workspace All Contributors

node-current npm npm downloads

Overview

This Webpack plugin provide a way to inject inline chunks into the HTML file generated by the html-webpack-plugin. It differs from some other inline html webpack plugins in that the script to inject does not need to be specified as an explicit chunk or entry point. Further, the injected script is built according to the webpack loaders, and is not inlined raw.

Only Webpack 5 is supported.

Installation

yarn add -D inject-inline-html-webpack-plugin

Then instantiate the plugin after the HtmlWebpackPlugin, and specify a inlineScripts in the html-webpack-plugin config:

plugins: [new HtmlWebpackPlugin({ inlineScripts: ['some-script.js'] }), new InjectInlineHtmlWebpackPlugin()]

Contributing

Contributions are welcome!

Contributors


Noah

🤔 💻 🚇

To add a contributor to the README, signal the all-contributors bot by adding comments in your PRs like so:

@all-contributors please add <username> for <contribution type>