-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (47 loc) · 1.46 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
52
53
54
55
56
57
var gulp = require('gulp'),
files = {
js: ['./source/js/*.js', './routes/*.js', './modules/*.js', './app.js'],
styl: ['./source/styl/main.styl', './source/styl/**/*.styl']
};
gulp.task('lint', function () {
var jshint = require('gulp-jshint'),
stylish = require('jshint-stylish');
gulp.src(files.js)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('build-js', function () {
var concat = require('gulp-concat'),
uglify = require('gulp-uglify');
gulp.src(files.js[0])
.pipe(concat('main.min.js'))
// .pipe(uglify())
.pipe(gulp.dest('./public/js'));
});
gulp.task('stylus', function () {
var stylus = require('gulp-stylus'),
autoprefixer = require('gulp-autoprefixer');
gulp.src(files.styl[0])
.pipe(stylus({compress: true}))
.pipe(autoprefixer())
.pipe(gulp.dest('./public/styles'));
});
gulp.task('server', function () {
var nodemon = require('gulp-nodemon');
nodemon({
script: 'app.js',
ext: 'html js',
ignore: [
'.git',
'node_modules/**/node_modules'
]
})
.on('change', ['lint'])
.on('restart', function () {
console.log('nodemon restarted server.');
});
});
gulp.task('watch', function () {
gulp.watch(files.js.concat(files.styl), ['stylus', 'lint', 'build-js']);
});
gulp.task('default', ['stylus', 'lint', 'build-js', 'server', 'watch']);