html-inline-css-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

html-inline-css-webpack-plugin

MIT Licence PRs Welcome npm version

Convert external style sheet(<link rel="stylesheet"/>) to internal style sheet(<style>...<style/>).

Require mini-css-extract-plugin and html-webpack-plugin

Install

NPM

npm install html-inline-css-webpack-plugin -D

Yarn

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

Minimal example

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HTMLInlineCSSWebpackPlugin = require("html-inline-css-webpack-plugin").default;

module.exports = {
  plugins: [
    new MiniCssExtractPlugin({
      filename: "[name].css",
      chunkFilename: "[id].css"
    }),
    new HtmlWebpackPlugin(),
    new HTMLInlineCSSWebpackPlugin(),
  ],
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          "css-loader"
        ]
      }
    ]
  }
}

Dependents (131)

Package Sidebar

Install

npm i html-inline-css-webpack-plugin@1.0.0

Version

1.0.0

License

MIT

Unpacked Size

8.52 kB

Total Files

6

Last publish

Collaborators

  • runjuu