-
Notifications
You must be signed in to change notification settings - Fork 59
/
gulpfile.js
51 lines (44 loc) · 1.08 KB
/
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
48
49
50
51
var gulp = require('gulp');
var browserify = require('browserify');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var fs = require('fs');
var mold = require('mold-source-map');
var paths = {
js : {
in: './lib/main.js',
out: './lib/build/main.js'
},
css : {
in: ['./css/*.styl'],
out: './css'
},
html: {
in: ['./views/*.jade'],
out: './output'
}
};
gulp.task('browserify', function(){
browserify(paths.js.in, {debug: true})
.bundle()
.pipe(mold.transformSourcesRelativeTo(__dirname))
.pipe(fs.createWriteStream(paths.js.out));
});
gulp.task('build-css', function(){
return gulp.src(paths.css.in)
.pipe(stylus({
set: ['compress']
}))
.pipe(gulp.dest(paths.css.out));
});
gulp.task('build-html', function(){
return gulp.src(paths.html.in)
.pipe(jade({pretty: true}))
.pipe(gulp.dest(paths.html.out));
});
gulp.task('watch', function() {
gulp.watch('./lib/*.js', ['browserify']);
gulp.watch(paths.css.in, ['build-css']);
gulp.watch(paths.html.in, ['build-html']);
});
gulp.task('default', ['browserify', 'build-html', 'build-css']);