@darcytech/html-webpack-tags-plugin
v1.2.4
Published
配置额外的 meta、 script、link 标签
Downloads
2
Maintainers
Readme
@darcytech/html-webpack-tags-plugin
html-webpack-tags-plugin 是一款扩展至 html-webpack-plugin 的插件, 作用是在构建时往 head 和 body 插入额外的 script 和 link 标签。
Usage
const HtmlWebpackTagsPlugin = require('@darcytech/html-webpack-tags-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
{
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackTagsPlugin({
headScripts: {
after: ['/a.js'],
before: [{ src: '/b.js', defer: true }],
},
bodyScripts: {
after: ['/c.js'],
before: [{ src: '/d.js', defer: true }],
},
links: {
after: [{ href: '/e.css', rel: 'stylesheet' }],
before: [{ href: '/f.css', rel: 'stylesheet' }],
},
}),
];
}