-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathgulpfile.js
26 lines (23 loc) · 979 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var gulp = require('gulp'),
browserify = require('browserify'),
fs = require('fs');
//================================= BUNDLE - Run Browserify - create client bundles for test cases =================================//
// See https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-with-globs.md
// Task to create Browserify client-side bundle scripts for Browserify test cases.
gulp.task('bundle', function() {
var tmplify = require('jsrender/tmplify');
var gs = require('glob-stream');
return gs('./test/browserify/*-unit-tests.js')
.on('data', function(file) {
// file has path, base, and cwd attrs
var fileName = file.path.slice(file.base.length, -14);
browserify(file.path, {debug:true})
.transform(tmplify)
.bundle()
.pipe(fs.createWriteStream('./test/browserify/bundles/' + fileName + "-bundle.js"))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
});