-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (38 loc) · 1.21 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
const gulp = require('gulp');
const livereload = require('gulp-livereload');
const nodemon = require('gulp-nodemon');
const sass = require('gulp-sass');
const config = require('./config/config');
const buildpublic = require('./app/dist-build');
// use livereload to send refresh message to livereloaded chrome plugin
livereload({ start: true });
// SASS compiling
gulp.task('sass', function() {
gulp.src('sass/**/*.scss')
.pipe(sass({indentedSyntax : false, includePaths: ['sass']})
.on('error', sass.logError))
.pipe(gulp.dest('static/css/'))
.pipe(livereload());
});
// watch for changes on njk file and sass files
gulp.task('watch', () => {
gulp.watch('views/**/*.html').on('change', (file) => {
livereload.changed(file.path);
});
gulp.watch('views/**/*.njk').on('change', (file) => {
livereload.changed(file.path);
});
gulp.watch('sass/**/*.scss', ['sass']);
livereload.listen();
});
// start nodemon server - watch js file and restart server if changed
gulp.task('server', () => {
nodemon({
script: 'app.js',
ext: '.js'
})
});
gulp.task('default', ['server', 'watch' ,'sass']);
gulp.task('build', function() {
buildpublic.build();
});