-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
40 lines (34 loc) · 969 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
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var exec = require('child_process').exec;
var ejs = require("gulp-ejs");
var gutil = require('gulp-util');
var ext_replace = require('gulp-ext-replace');
gulp.task('nodemon', function() {
nodemon({
script: 'index.js',
ext: 'js html'
// other config ...
});
});
gulp.task('html', function(){
return gulp.src('./src/*.ejs')
.pipe(ejs({})
.on('error', gutil.log))
.pipe(ext_replace('.html', '.html.ejs'))
.pipe(gulp.dest('./public'));
});
gulp.task('js', function() {
return gulp.src('./src/js/*.js')
.pipe(gulp.dest('./public/js'));
});
gulp.task('css', function() {
return gulp.src('./src/css/*.css')
.pipe(gulp.dest('./public/css'));
});
gulp.task('watch', function() {
gulp.watch('./src/**/*.ejs', ['html']);
gulp.watch('./src/js/*.js', ['js']);
gulp.watch('./src/css/*.css', ['css']);
});
gulp.task('default', ['html', 'js', 'css', 'nodemon', 'watch']);