Skip to content

Commit 23fa754

Browse files
committed
add logger after bundling is done
1 parent 91bf6af commit 23fa754

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tasks/bundle.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,39 @@ function _bundle(pathToIndex, pathToBundle, opts) {
7070
opts = opts || {};
7171

7272
// do we output a minified file?
73-
var outputMinified = !!opts.pathToMinBundle && !opts.debug;
73+
var pathToMinBundle = opts.pathToMinBundle,
74+
outputMinified = !!pathToMinBundle && !opts.debug;
7475

7576
var browserifyOpts = {};
7677
browserifyOpts.standalone = opts.standalone;
7778
browserifyOpts.debug = opts.debug;
7879
browserifyOpts.transform = outputMinified ? [compressAttributes] : [];
7980

80-
browserify(pathToIndex, browserifyOpts).bundle(function(err, buf) {
81+
var b = browserify(pathToIndex, browserifyOpts),
82+
bundleWriteStream = fs.createWriteStream(pathToBundle);
83+
84+
bundleWriteStream.on('finish', function() {
85+
logger(pathToBundle);
86+
});
87+
88+
b.bundle(function(err, buf) {
8189
if(err) throw err;
8290

8391
if(outputMinified) {
8492
var minifiedCode = UglifyJS.minify(buf.toString(), constants.uglifyOptions).code;
8593

86-
fs.writeFile(opts.pathToMinBundle, minifiedCode);
94+
fs.writeFile(pathToMinBundle, minifiedCode, function(err) {
95+
if(err) throw err;
96+
97+
logger(pathToMinBundle);
98+
});
8799
}
88100
})
89-
.pipe(fs.createWriteStream(pathToBundle));
101+
.pipe(bundleWriteStream);
102+
}
103+
104+
function logger(pathToOutput) {
105+
var log = 'ok ' + path.basename(pathToOutput);
106+
107+
console.log(log);
90108
}

0 commit comments

Comments
 (0)