html-variables-plugin

1.0.0 • Public • Published

HTML Variables Plugin

This is a plugin designed for injecting variables to HTML templates via HtmlWebpackPlugin. To use this plugin, add this to your webpack right after the HtmlWebpackPlugin. This plugin accepts an object as parameter, which contains key value pairs of the variables to be injected.

Usage

The following example declars a variable named 'foo', which it's value is 'bar'.

In your Webpack config:

const HtmlVariablesPlugin = require('html-variables-plugin');

module.exports = {
  // ... Other settings
  plugins: [
    // ... HtmlWebpackPlugin and Other plugins
    new HtmlVariablesPlugin({ foo: 'bar' })
  ]
}

In your HTML:

<h1>%foo%</h1>

Reference

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i html-variables-plugin

      Weekly Downloads

      188

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      4.64 kB

      Total Files

      6

      Last publish

      Collaborators

      • icelam