-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
67 lines (53 loc) · 1.7 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
'use strict';
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifyHtml = require("gulp-minify-html");
var minifyCss = require("gulp-minify-css");
var nodemon = require('gulp-nodemon');
var path = require('path');
var util = require('gulp-util');
// Lint Task
gulp.task('hint', function() {
return gulp.src('./server/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('./client/public/javascript/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('./dist/client/public/js'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/client/public/js'));
});
gulp.task('minify-html', function () {
gulp.src('./client/public/static_pages/*.html') // path to your files
.pipe(minifyHtml())
.pipe(gulp.dest('./dist/client/public/static_pages'));
});
gulp.task('minify-css', function () {
gulp.src('./client/public/css/*.css') // path to your file
.pipe(minifyCss())
.pipe(gulp.dest('./dist/client/public/css'));
});
// MONITOR SERVER FOR CHANGES & RESTART
gulp.task('nodemon', function() {
util.log('Running gulp task "NODEMON"');
nodemon({
script: path.resolve('server', 'server.js'),
ext: 'js, html',
ignore: ['README.md', 'node_modules/**', '.DS_Store', 'dist']
})
.on('change');
});
gulp.task('watch', function() {
gulp.watch(['./server/**', './client/**'], function() {
gulp.start('nodemon');
});
});
// gulp.task('default', ['hint', 'watch']);
gulp.task('default', ['nodemon']);