Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SilverPixelInteractive/html-inline-script-webpack-plugin

Open more actions menu
 
 

Repository files navigation

HTML Inline Script Webpack Plugin (html-inline-script-webpack-plugin)

Latest version Download count Install size

A webpack plugin for converting external script files <script src="app.js"></script> to inline script block <script>...</script>. Requires html-webpack-plugin to work.

Inspired by react-dev-utils created by Facebook.

Install

NPM

npm i html-inline-script-webpack-plugin -D

Yarn

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

Usage

By default, the plugin will convert all the external script files to inline script block.

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin(),
    new HtmlInlineScriptPlugin(),
  ]
}

To limit the scope of the plugin, specify lists of files you wish to convert in regular expressions:

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin(),
    new HtmlInlineScriptPlugin([
      /runtime~.+[.]js/,
      /app~.+[.]js/
    ]),
  ]
}

About

A webpack plugin for converting external script files to inline script block. Requires 'html-webpack-plugin' to work.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.3%
  • JavaScript 2.7%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.