gulp-auto-rollup
Automatic ES6 Module Bundler
Last updated 2 years ago by thomasbrierley .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-auto-rollup 
SYNC missed versions from official npm registry.

Gulp-Auto-Rollup

Automatic ES6 Module Bundler

Intended as an ES6 module support drop-in, if your ES6 modules work nativeley in the browser, this plugin should be able to bundle them automatically. So you can develop with native modules, and bundle without explicit configuration.

Gulp-Auto-Rollup can take a mixed stream of js modules and non-modules. Automatically determine multiple entry points, provide per entry options, bundle them with rollup, and passthrough any non-modules untouched.

Install

npm install --save gulp-auto-rollup

Usage

Basic usage with Gulp:

const gulp = require('gulp');
const autoRollup = require('gulp-auto-rollup');

gulp.task('Bundle', () => gulp.src('src/**/*.js')
	.pipe(autoRollup(path => ({
		format: 'iife'
	})))
	.pipe(gulp.dest('dist'));
);

Basic usage with Gurt:

const autoRollup = require('gulp-auto-rollup');

module.exports['Bundle'] = (stream, filter) => stream
	.pipe(filter('**/*.js'))
	.pipe(autoRollup(path => ({
		format: 'iife'
	})));

Example Input:

A.js
    \
    B.js
        \
D.js    C.js
    \
    E.js
    /   \
G.js    F.js
    \
    H.js
        \
J.js    I.js

Example Output:

A.js => Bundle of A, B, C
D.js => Bundle of D, E, F
G.js => Bundle of G, E, F, H, I
J.js => Untouched

API

autoRollup([options])

Type: Function

Called for each entry, receives the entry path and returns an options object, a combination of the rollup and generate options. See the rollup API for details.

Contribute

Suggestions and contributions will be considered. When crafting a pull request please consider if your contribution is a good fit with the project, follow contribution best practices and use the github "flow" workflow.

License

The MIT License

Current Tags

  • 1.0.4                                ...           latest (2 years ago)

5 Versions

  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 2
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |