-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
72 lines (63 loc) · 1.49 KB
/
gulpfile.js
File metadata and controls
72 lines (63 loc) · 1.49 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
65
66
67
68
69
70
71
72
"use strict";
var gulp = require('gulp'),
less = require('gulp-less'),
path = require('path'),
rename = require('gulp-rename'),
nodemon = require('gulp-nodemon'),
jshint = require('gulp-jshint'),
livereload = require('gulp-livereload'),
uglify = require('gulp-uglifyjs'),
install = require('gulp-install');
// install package dependencies
gulp.task('install', function () {
gulp.src(['./bower.json', './package.json'])
.pipe(install());
});
// jshint
gulp.task('jshint', function () {
gulp.src('./*.js')
.pipe(jshint())
});
// concatenate and minify client-side JS
gulp.task('uglify', function () {
gulp.src('./public/js/*.js')
.pipe(gulp.dest('./dist/js'))
.pipe(rjs({
baseUrl: 'dist/js'
}))
.pipe(livereload());
});
// compile LESS
gulp.task('less', function () {
// core.less
gulp.src('./public/less/core.less')
.pipe(less({
lint: true,
compress: true
}))
.pipe(gulp.dest('./public/dist'))
.pipe(livereload());
});
// watch for file changes
gulp.task('watch', function () {
gulp.watch('./public/less/*.less', ['less']);
//gulp.watch('./public/js/*.js', ['require-uglify']);
});
// nodemon: automatically reload env when files change
gulp.task('nodemon', function () {
nodemon({
script: 'app.js',
ext: 'js html',
ignore: ['public/*'],
nodeArgs: ['--debug'],
env: {
'NODE_ENV': 'development'
}
})
.on('change', ['jshint'])
.on('restart', function () {
console.log('restart');
});
});
// runtime
gulp.task('default', ['nodemon', 'watch', 'install']);