metalsmith-browserify
Advanced tools
Comparing version 0.2.4 to 0.3.0
27
index.js
@@ -47,17 +47,20 @@ 'use strict'; | ||
function create(first) { | ||
var s; | ||
if (options.sourcemaps) { | ||
s = b.bundle() | ||
.on('error', console.error.bind(console)) | ||
.pipe(exorcist(bundleDest + '.map')) | ||
.pipe(fs.createWriteStream(bundleDest), 'utf8'); | ||
b.bundle(function(err, buffer) { | ||
if (err) return callback(err); | ||
files[options.dest] = { | ||
contents: buffer | ||
}; | ||
callback(); | ||
}) | ||
.pipe(exorcist(bundleDest + '.map')); | ||
} else { | ||
s = b.bundle() | ||
.on('error', console.error.bind(console)) | ||
.pipe(fs.createWriteStream(bundleDest), 'utf8'); | ||
b.bundle(function(err, buffer) { | ||
if (err) return callback(err); | ||
files[options.dest] = { | ||
contents: buffer | ||
}; | ||
callback(); | ||
}); | ||
} | ||
if (first) { | ||
s.on('finish', callback); | ||
} | ||
} | ||
@@ -64,0 +67,0 @@ |
{ | ||
"name": "metalsmith-browserify", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "Metalsmith plugin to bundle JS with browserify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,21 +38,2 @@ [![Build Status](https://travis-ci.org/kopa-app/metalsmith-browserify.svg)](https://travis-ci.org/kopa-app/metalsmith-browserify) | ||
If you need to manipulate the created browserify bundle do: | ||
```javascript | ||
var metalsmith = require('metalsmith'); | ||
var browserify = require('metalsmith-browserify'); | ||
var b = browserify({ | ||
dest: 'js/bundle.js', | ||
entires: ['./src/js/index.js'] | ||
); | ||
// do stuff with the bundle | ||
b.bundle.external(/*...*/); | ||
metalsmith(__dirname) | ||
.use(b) // use the plugin | ||
.build() | ||
``` | ||
It can also be used with `metalsmith.json` by adding the plugin like this: | ||
@@ -59,0 +40,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124
6190
8
62