handle-inject-html-webpack-plugin

0.0.7 • Public • Published

作用

需要改变index.html中注入的js文件和css文件 例如在使用dll打包时,可以使用该plugin改变index.html中的注入

使用示例

const HandleInjectHtmlWebpackPlugin = require('handle-inject-html-webpack-plugin')

...
plugins: [
    new HandleInjectHtmlWebpackPlugin({
        js: 'your js file path'
    })
]
...

配置项

配置项 类型
js String/Array/Function/Object
css String/Array/Function/Object

配置示例

  • String
new HandleInjectHtmlWebpackPlugin({
    js: 'your js file path'
})
  • Object
new HandleInjectHtmlWebpackPlugin({
    js: {
        path: 'your js file path',
        pos: 'pre' // pos属性为 pre 时,这个js文件会放在最前方注入,其他属性无效
    }
})
  • Object
new HandleInjectHtmlWebpackPlugin({
    js: [{
        path: 'your js file path',
        pos: 'pre' // pos属性为 pre 时,这个js文件会放在最前方注入,其他属性无效
    }, 'your js file path']
})
  • function
new HandleInjectHtmlWebpackPlugin({
    js: function (originalJsFileList) {
        return ... // 需要返回一个数组
    }
})

Readme

Keywords

none

Package Sidebar

Install

npm i handle-inject-html-webpack-plugin

Weekly Downloads

4

Version

0.0.7

License

ISC

Unpacked Size

5.04 kB

Total Files

5

Last publish

Collaborators

  • zgn