3.0.1 • Published 7 years ago

smart-banner-webpack-plugin v3.0.1

Weekly downloads
44
License
MIT
Repository
-
Last release
7 years ago

smart-banner-webpack-plugin

Version npm NPM Download Dependencies

This is a smart banner webpack plugin which has the same function and usage as webpack.BannerPlugin and supports filename syntax in banner string

Note: This is a clone of webpack.BannerPlugin with the only difference that it supports variable filename in banner string which will be replaced by the chunk filename

Usage

The use of smart-banner-webpack-plugin 2.0.0 and 3.0.0 has a little difference which is illustrated in the following examples.

// webpack 1
import SmartBannerPlugin from 'smart-banner-webpack-plugin';

// part of webpack.config.js
{
  ...
  plugins: [
    new SmartBannerPlugin(
      `[filename] v1.0.0\n\nAuthor: johvin\nDate: ${new Date().toLocaleString()}\n`,
      { raw: false, entryOnly: true })
  ],
  ...
}
// webpack 2
import SmartBannerPlugin from 'smart-banner-webpack-plugin';

// part of webpack.config.js
{
  ...
  plugins: [
    new SmartBannerPlugin({
      banner: `[filename] v1.0.0\n\nAuthor: johvin\nDate: ${new Date().toLocaleString()}\n`,
      raw: false,
      entryOnly: true
    })
  ],
  ...
}

filename is replaced by the chunk filename in the process of compilation, e.g. the code below is a processed banner

/*!
 * server.js v1.0.0
 *
 * Author: johvin
 * Date: 2016-08-04 09:37:05
 *
 */

Change log

CHANGE LOG

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

8 years ago

1.0.0

8 years ago