Have ideas to improve npm?Join in the discussion! »

    This package has been deprecated

    Author message:

    Changes have been merged into metalsmith-browserify, use that instead

    metalsmith-browserifi

    1.0.0 • Public • Published

    metalsmith-browserifi

    npm version build status coverage status greenkeeper downloads

    A metalsmith plugin for bundling javascript with browserify

    There are already a couple of browserify plugins for metalsmith. However, none of them are quite right in my opinion. There are some that don't update the metalsmith files object, which means that you can't use metalsmith plugins to futher manipulate the resulting bundle. Others just have a cumbersome api or haven't been maintained.

    So I created this plugin to address those issues. By allowing you to pass options directly to browserify it allows you to do everything you would normally do with browserify, like transforms, inline sourcemaps, etc. By adhering to metalsmith plugin conventions it works as you'd expect a metalsmith plugin to work.

    For support questions please use stack overflow or our slack channel. For browserify specific questions try their documentation.

    Installation

    $ npm install metalsmith-browserifi

    Options

    You can pass options to metalsmith-browserifi with the Javascript API or CLI. The options are:

    • entries: required. The entry points that need to be browserified. Accepts an array of strings.
    • browserifyOptions: optional. These options will be passed on to browserify. See this area of the browserify documentation for all available options. Note that it's possible to break stuff here, like overriding the entries, so use wisely. The default is undefined.

    entries

    The entry points that should be browserified. So this metalsmith.json:

    {
      "source": "src",
      "destination": "build",
      "plugins": {
        "metalsmith-browserifi": {
          "entries": [
            "index.js",
            "another.js"
          ]
        }
      }
    }

    Would browserify both ./src/index.js and ./src/another.js and output them as ./build/index.js and ./build/another.js respectively.

    browserifyOptions

    Use this to pass options to browserify. So this metalsmith.json:

    {
      "source": "src",
      "destination": "build",
      "plugins": {
        "metalsmith-browserifi": {
          "entries": ["index.js"],
          "browserifyOptions": {
            "debug": true
          }
        }
      }
    }

    Would enable browserify's debug option, and add an inline source map as well.

    Errors and debugging

    If you're encountering problems you can use debug to enable verbose logging. To enable debug prefix your build command with DEBUG=metalsmith-browserifi. So if you normally run metalsmith to build, use DEBUG=metalsmith-browserifi metalsmith (on windows the syntax is slightly different).

    License

    MIT

    Keywords

    none

    Install

    npm i metalsmith-browserifi

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    58.3 kB

    Total Files

    19

    Last publish

    Collaborators

    • avatar