This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (63 loc) · 2.04 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// load the plugins
var gulp = require('gulp');
//var less = require('gulp-less');
//var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var nodemon = require('gulp-nodemon');
// define a task called css
gulp.task('css', function() {
// grab the less file, process the LESS, save to style.css
return gulp.src('public/assets/css/style.less')
.pipe(less())
.pipe(minifyCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('public/assets/css'));
});
// task for linting js files
gulp.task('js', function() {
return gulp.src(['server.js', 'public/app/*.js', 'public/app/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// task to lint, minify, and concat frontend files
gulp.task('scripts', function() {
return gulp.src(['public/app/*.js', 'public/app/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(gulp.dest('public/dist'));
});
// task to lint, minify, and concat frontend angular files
gulp.task('angular', function() {
return gulp.src(['public/app/*.js', 'public/app/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(ngAnnotate())
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest('public/dist'));
});
gulp.task('watch', function() {
// watch the less file and run the css task
//gulp.watch('public/assets/css/style.less', ['css']);
// watch js files and run lint and run js and angular tasks
gulp.watch(['server.js', 'public/app/*.js', 'public/app/**/*.js'], ['js', 'angular']);
});
gulp.task('nodemon', function() {
nodemon({
script: 'server.js',
//ext: 'js less html'
ext: 'js css html'
})
.on('start', ['watch'])
.on('change', ['watch'])
.on('restart', function() {
console.log('Restarted!');
});
});
gulp.task('default', ['nodemon']);