Socket
Book a DemoInstallSign in
Socket

@lukeed/fly-browserify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lukeed/fly-browserify

Browserify plugin for Fly.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

fly-browserify

Browserify plugin for Fly

Install

npm install --save-dev @lukeed/fly-browserify

Note:: Plugin exists as a scoped package while the original remains inactive.

API

.browserify(options)

Please see Browserify's documentation for a full list of available options.

options.entries

Type: string or array
Default: ''

Define "entry" files, which represent new bundles. Optional. See an example usage.

Note: If not specified, fly-browserify will assumes all files within fly.source() are new bundle entries.

Important: This plugin (fly-browserify) enforces new a bundle per entry unlike browserify.

Using this option is particularly handy when your task (eg, scripts) contains plugin methods whose source files should be more than your entry files.

exports.scripts = function * () {
  yield this.source('src/scripts/app.js')
    .xo() // ONLY lints one file
    .browserify() // make 'app.js' bundle
    .target('dist/js'); //=> dist/js/app.js

  /* VS */

  yield this.source('src/**/*.js')
    .xo() // lints ALL files
    .browserify({
      entries: 'src/scripts/app.js'
    }) // make 'app.js' bundle
    .target('dist/js'); //=> dist/js/app.js
}

Usage

Basic

exports.default = function * () {
  yield this.source('src/scripts/app.js')
    .browserify()
    .target('dist');
};

Transforms

There's a huge list of browserify transforms available to you. You may require() any of them & include their functionalities in your bundles.

exports.default = function * () {
  yield this.source('src/scripts/app.js')
    .browserify({
      transform: [require('reactify')]
    })
    .target('dist');
};

Multiple Bundles

There are a handful of ways you can create multiple browserify "bundles" without the need to repeat your task.

Direct Paths via fly.source()

exports.default = function * () {
  yield this.source([
      'src/scripts/app.js',
      'src/scripts/admin.js'
    ])
    .browserify()
    .target('dist');
}

Glob Patterns via fly.source()

exports.default = function * () {
  yield this.source('src/entries/*.js')
    .browserify()
    .target('dist');
}

Direct Paths via opts.entries

exports.default = function * () {
  yield this.source('src/**/*.js')
    .browserify({
      entries: [
       'src/scripts/app.js',
       'src/scripts/admin.js'
      ]
    })
    .target('dist');
}

License

MIT © Luke Edwards

Keywords

fly

FAQs

Package last updated on 05 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts