atomify-js
Advanced tools
Comparing version 2.0.0 to 2.1.0
16
index.js
var browserify = require('browserify') | ||
, path = require('path') | ||
, events = require('events') | ||
, watchify = require('watchify') | ||
@@ -12,4 +13,5 @@ , ejsify = require('ejsify') | ||
, writer = require('write-to-path') | ||
, emitter = new events.EventEmitter() | ||
module.exports = function (opts, cb) { | ||
var ctor = module.exports = function (opts, cb) { | ||
if (Array.isArray(opts)) opts = {entries: opts} | ||
@@ -42,5 +44,13 @@ if (typeof opts === 'string') opts = {entries: [opts]} | ||
if (opts.watch) { | ||
b.on('update', function () { | ||
b.on('update', function (ids) { | ||
ids.forEach(function (id) { | ||
emitter.emit('changed', id) | ||
}) | ||
b.bundle(opts, cb) | ||
}) | ||
b.on('time', function (time) { | ||
emitter.emit('bundle', time) | ||
}) | ||
} | ||
@@ -92,1 +102,3 @@ | ||
} | ||
ctor.emitter = emitter |
{ | ||
"name": "atomify-js", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Atomic JavaScript - Reusable front-end modules using Browserify, transforms, and templates", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
25703
83