browserify-cord
Advanced tools
Comparing version
23
index.js
@@ -5,4 +5,6 @@ /* A module for generating multiple browserify bundles. | ||
dest: string, | ||
src: string, | ||
extname?: string, | ||
log?: () => string | ||
plugin?: any[], | ||
log?: () => string, | ||
}) => { update: () => void } | ||
@@ -16,3 +18,2 @@ */ | ||
const source = require('vinyl-source-stream') | ||
const watchify = require('watchify') | ||
@@ -29,17 +30,17 @@ const invoke = f => f() | ||
function bundle() { | ||
b.bundle() | ||
.on('error', options.log) | ||
.pipe(source(path.basename(entry))) | ||
.pipe(rename({ extname: options.extname })) | ||
.pipe(gulp.dest(options.dest)) | ||
return b.bundle() | ||
.on('error', options.log) | ||
.pipe(source(path.basename(entry))) | ||
.pipe(rename({ extname: options.extname })) | ||
.pipe(gulp.dest(path.join(options.dest, path.dirname(entry)))) | ||
} | ||
const b = browserify({ | ||
entries: [entry], | ||
entries: [path.join(options.src, entry)], | ||
cache: {}, | ||
packageCache: {}, | ||
plugin: [watchify] | ||
plugin: options.plugin | ||
}) | ||
b.on('update', bundle) | ||
b.on('log', options.log) | ||
.on('update', bundle) | ||
.on('log', options.log) | ||
@@ -46,0 +47,0 @@ return bundle |
{ | ||
"name": "browserify-cord", | ||
"version": "0.1.0", | ||
"description": "A module for generating multiple browserify bundles with gulp.'", | ||
"version": "0.2.0", | ||
"description": "A module for generating multiple browserify bundles with gulp.", | ||
"license": "ISC", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/raineorshine/browserify-cord", |
@@ -5,3 +5,3 @@ # browserify-cord | ||
A module for generating multiple browserify bundles with gulp.' | ||
A module for generating multiple browserify bundles with gulp. | ||
@@ -20,4 +20,6 @@ ## Install | ||
const cord = Cord({ | ||
entries: ['./src/public/main.js'], | ||
dest: './app/public/scripts' | ||
entries: ['public/main.js'], // relative to 'src' | ||
src: 'src' | ||
dest: 'app', | ||
plugin: [watchify, tsify] | ||
}) | ||
@@ -24,0 +26,0 @@ |
3772
3.06%44
2.33%34
6.25%