2.2.1 • Published 11 months ago

hwp-attributes-plugin v2.2.1

Weekly downloads
64
License
MIT
Repository
github
Last release
11 months ago

hwp-attributes-plugin

Build and Test CodeQL

Plugin to add various attributes to script tags injected by html-webpack-plugin

Installation

npm i -D hwp-attributes-plugin

Usage

import { HwpAttributesPlugin } from 'hwp-attributes-plugin';

// Webpack configuration object
export default {

    plugins: [
        new HtmlWebpackPlugin({ /* ... */ }),
        new HwpAttributesPlugin({
            module: ['**.mjs'],
            nomodule: ['polyfills.js'],
            async: ['some-async-script.js', 'another-async-script.js'],
            defer: ['script-to-defer.*.js'],
        }),
    ],
};

To configure the plugin, pass an object with the following keys to its constructor (all keys are optional):

  • module: patterns of scripts that should have the module attribute added;
  • nomodule: patterns of scripts that should have the nomodule attribute added;
  • async: patterns of scripts that should have the async attribute added;
  • defer: patterns of scripts that should have the defer attribute added.

The plugin performs pattern matching with the help of minimatch.

The module and nomodule attributes are mutually exclusive, module takes precedence. If the same file matches both module and nomodule patterns, it will have the module attribute.

2.2.1

11 months ago

2.2.0

11 months ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago