-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (38 loc) · 1019 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"use strict";
var gulp = require('gulp')
var source = require('vinyl-source-stream')
var browserify = require('browserify')
var karma = require('karma').server
var plugins = require('gulp-load-plugins')()
var hbsfy = require("hbsfy")
/**********************
* Test task.
**********************/
// Run test once and exit
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done)
})
// Watch for file changes and re-run tests on each change
gulp.task('tdd', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js'
}, done)
})
/**
* Browserify the index.js to bundle.js
*/
gulp.task('browserify', function () {
hbsfy.configure({
extensions: ['hbs']
})
var bundleStream = browserify('./index.js').transform(hbsfy).bundle()
bundleStream
.pipe(source('index.js'))
.pipe(plugins.plumber())
.pipe(plugins.rename('bundle.js'))
.pipe(gulp.dest('./'))
})
gulp.task('default', ['browserify']);