@darcytech/html-webpack-tags-plugin

1.2.4 • Public • Published

@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' }],
      },
    }),
  ];
}

Package Sidebar

Install

npm i @darcytech/html-webpack-tags-plugin

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

9.76 kB

Total Files

6

Last publish

Collaborators

  • noshower