0.0.7 • Published 4 years ago

inline-script-plugin v0.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

inline-script-plugin

加强 html-webpack-plugin插件

将给定路径的script插入到所有js脚本的最前面, 或直接插入到head标签中

提供以inline的形式插入到html中

使用前确保有安装 html-webpack-plugin

安装

npm i inline-script-plugin -D

使用

inline-script-plugin添加到webpack插件配置当中:

// vue.config.js为例
const InlineScriptPlugin = require('inline-script-plugin')

module.exports = {
  xxx,
  chainWebpack: config => {
    config
      .plugin('InlineScriptPlugin')
      .after('html')
      .use(InlineScriptPlugin, [
        {
          name: 'abc', // yourName
          path: './a/b.js', // yourPath
          inhead: true,
          inline: true
        }
      ])
      .end()
  }
}

有关 options 配置如下:

字段名参数类型默认值是否必填说明
nameString-文件名
pathString-文件路径
inlineBooleanfalse是否以inline形式插入脚本
inheadBooleanfalse是否将脚本插入到head标签里
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago