Skip to content

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

License

Notifications You must be signed in to change notification settings

johvin/smart-banner-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published