-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
57 lines (44 loc) · 1.24 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
/* jshint node: true */
'use strict';
/**
* Build system for the project. To keep things simple, this is intentionally missing many of the
* features commonly seen in production systems, such as minification, concatenation, module wrapping
* etc.
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourceMaps = require('gulp-sourcemaps');
var gls = require('gulp-live-server');
var SERVER_MAIN_SCRIPT = 'server/index.js';
var PATHS = {
BUILD_DIR: 'app/build',
SCSS: [
'app/scss/**/*.scss'
],
SCSS_INCLUDE: [
'node_modules/bootstrap-sass/assets/stylesheets'
]
};
gulp.task('styles', function () {
return gulp.src(PATHS.SCSS)
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourceMaps.write())
.pipe(gulp.dest(PATHS.BUILD_DIR));
});
gulp.task('styles:watch', function () {
return gulp.watch(PATHS.SCSS, ['styles']);
});
gulp.task('serve', ['styles'], function serve() {
var server = gls(SERVER_MAIN_SCRIPT, {}, false /* no livereload, would be confusing */);
// Restart server if it is changed
gulp.watch(SERVER_MAIN_SCRIPT, function restartServer() {
server.start();
});
server.start();
});
gulp.task('default', [
'styles',
'styles:watch',
'serve'
]);