@bundles/bundles-banner

    0.0.4 • Public • Published

    Bundles Banner Bundler

    NPM version NPM downloads per month Travis branch Codacy code grade Codacy coverage Coverage Status JavaScript Style Guide code style: prettier semantic release Commitizen friendly License Greenkeeper badge

    This is a bundler plugin for use with Bundles. bundles-banner prepends a file banner to the content for specified files.

    Environment support

    Node CLI ES Module Browser UMD
    x x

    Install

    Make sure Bundles is installed.

    npm install @bundles/bundles-banner -D

    Usage

    See configuring Bundles for how to configure Bundles and bundlers.

    Configuration

    The following properties are available in bundler.options:

    • include {String[]|Function} (['.js', '.css']) Determines whether filepath should include a banner. If String Array matches the file extension, or if a Function returns true, a banner is added.
    • prefix {String} ('/*! ') Banner prefix.
    • suffix {String} (' */') Banner suffix.
    • metadata {String[]|Array[]|Function|Function[]} (['author', 'reference']) Metadata to add to banner. Each item in the Array represents a parameter name, and the value of the parameter. Each item can be a String, an Array where item[0] is the parameter's name and item[1] is the value, or a Function which returns a String or Array. See example below.
    • joinWith {String} (' | ') Character(s) to join metadata with.
    • paramNameChar {String} ('@') Character(s) to prepend parameter name with.

    Example

    const bundle = {
        input: [...],
        bundlers: [{
            run: '@bundles/bundles-banner',
            include: ['.js'],
            // Metadata can be String, Array, or Function.
            metadata: ['author', ['my-param', 'This is my param.'], (file) => {
                if (file.data.myProp) return ['custom-param', 'Value is ' + file.data.myProp]
                return false
            }],
            joinWith: ' - '
        }]
    }

    Assuming the following data:

    author: Snoopy
    myProp: true

    the above example will return:

    /*! @author Snoopy - @my-param This is my param. - @custom-param Value is true */

    Install

    npm i @bundles/bundles-banner

    DownloadsWeekly Downloads

    0

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    8.33 kB

    Total Files

    4

    Last publish

    Collaborators

    • thezimmee