snowpack-plugin-banner

1.0.1 • Public • Published

snowpack-plugin-banner

Add comments to the production asset files (JS/CSS) of your Snowpack build.

This plugin uses the dedent package under the hood, so you don't need to worry about overly-indented files in your final build files. Adding multi-line, indented template string literals is no issue thanks to this.

Install

npm

npm i -D snowpack-plugin-banner

Options

Name Type Value(s) / Default Description
banner string The comment you want adding to your file.
position string top | bottom / top Decide whether to add the comment to the top or bottom of the file.
include array [string] / [] A list of files to add the comment to, relative to your public directory.
exclude array [string] / [] A list of files to ignore, relative to your public directory.

Usage

Add comment to bottom of file, omitting the position property will default the comment to the top.

// snowpack.config.js
module.exports = {
  // ...
  plugins: [
    ['snowpack-plugin-banner', {
      banner: `
        /**
          * Copyright (c) my company 2022
          * LICENSE: MIT
          */
      `,
      position: 'bottom'
    }
  ]
  // ...
}

Only add comment to a subset of files

// snowpack.config.js
module.exports = {
  // ...
  plugins: [
    ['snowpack-plugin-banner', {
      banner: `
        /**
          * Copyright (c) my company 2022
          * LICENSE: MIT
          */
      `,
      include: ['app.js', 'styles.css', 'utils.js']
    }
  ]
  // ...
}

Add to all files, but exclude a subset

// snowpack.config.js
module.exports = {
  // ...
  plugins: [
    ['snowpack-plugin-banner', {
      banner: `
        /**
          * Copyright (c) my company 2022
          * LICENSE: MIT
          */
      `,
      exclude: ['utils.js']
    }
  ]
  // ...
}

Package Sidebar

Install

npm i snowpack-plugin-banner

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

3.74 kB

Total Files

3

Last publish

Collaborators

  • markshall