1.0.3 • Published 7 years ago

injectjscss-template-html-webpack-plugin v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

injectjscss-template-html-webpack-plugin

replace html-webpack-plugin injected js、css url

webpack1+

install

npm install injectjscss-template-html-webpack-plugin
or
yarn add injectjscss-template-html-webpack-plugin

use

const injectJsCssTemplateHtmlWebpackPlugin  = require('injectjscss-template-html-webpack-plugin');
const htmlWebpackPlugin = require('html-webpack-plugin');
/* webpack config add */
plugin: [
  new htmlWebpackPlugin({....}),

  new injectJsCssTemplateHtmlWebpackPlugin(options), // this must be behind the html-webpack-plugin

  ....
]

options

Object or Array

  • injectTemplateId - number

    when html-wepack-plugin is multiple, injectJsCssTemplateHtmlWebpackPlugin will through injectTemplateId match, and the options must be Array.

    html-webpack-plugin option must add the same injectTemplateId

    example:

plugin: [
      new htmlWebpackPlugin({
        injectTemplateId: 0,
        ....
      }),
      new htmlWebpackPlugin({
        injectTemplateId: 1,
        ....
      }),
      new injectJsCssTemplateHtmlWebpackPlugin([{
        injectTemplateId: 0,
        ...
      },{
        injectTemplateId: 1,
        ...
      }])
]
  • jstemplate - function
function(everypath){
    .....
    return path;
}
  • csstemplate - function
function(everypath){
    .....
    return path;
}
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago