1.0.1 • Published 2 years ago

snowpack-plugin-banner v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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

NameTypeValue(s) / DefaultDescription
bannerstringThe comment you want adding to your file.
positionstringtop \| bottom / topDecide whether to add the comment to the top or bottom of the file.
includearray[string] / []A list of files to add the comment to, relative to your public directory.
excludearray[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']
    }
  ]
  // ...
}
1.0.1

2 years ago

1.0.0

2 years ago