-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
64 lines (56 loc) · 1.57 KB
/
gulpfile.js
File metadata and controls
64 lines (56 loc) · 1.57 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict';
var gulp = require("gulp");
var clean = require('gulp-clean');
var jade = require('gulp-jade');
var gutil = require("gulp-util");
var webpack = require("webpack");
var webpackConf = require("./webpack.config.js");
var livereload = require('gulp-livereload');
var nodemon = require('gulp-nodemon');
var karma = require('gulp-karma');
gulp.task('test', function() {
// Be sure to return the stream
// NOTE: Using the fake './foobar' so as to run the files
// listed in karma.conf.js INSTEAD of what was passed to
// gulp.src !
return gulp.src('./foobar')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
console.log(err);
this.emit('end'); //instead of erroring the stream, end it
});
});
gulp.task("clean", function(done){
gulp.src('./dist', {read: false})
.pipe(clean());
done();
});
gulp.task("webpack", ["clean"], function(callback) {
// run webpack
webpack(
webpackConf,
function(err, stats) {
if(err) {throw new gutil.PluginError("webpack", err);}
gutil.log("[webpack]", stats.toString({
// output options
}));
callback();
});
});
gulp.task("build",["webpack"], function(done){
gulp.src('./src/index.jade')
.pipe(jade())
.pipe(gulp.dest('./dist'));
done();
});
gulp.task('develop', ['build'], function() {
livereload.listen();
nodemon({ script: 'index.js'});
gulp.watch('./src/**/*', ['build', function(){
livereload.changed();
}]);
});