This repository has been archived by the owner on Jul 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
64 lines (54 loc) · 1.53 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
const gulp = require('gulp');
const obt = require('origami-build-tools');
const nodemon = require('gulp-nodemon');
const livereload = require('gulp-livereload');
let appServer;
gulp.task('build', function () {
return obt.build(gulp, {
sass: './demos/main.scss',
buildCss: 'main.css',
buildFolder: 'public',
env: process.env.NODE_ENV
});
});
gulp.task('build-page', function () {
return obt.build(gulp, {
sass: './demos/main.scss',
buildCss: 'main.css',
buildFolder: 'public',
env: process.env.NODE_ENV
});
});
gulp.task('install', function () {
return obt.install();
});
gulp.task('test', function () {
return obt.test.npmTest(gulp);
});
gulp.task('serve', ['dev-add-livereload', 'build', 'build-page'], function (){
appServer = nodemon({
'script': 'demos/app.js',
'verbose': true,
'watch': false,
'ignore': ['*.*']
}).on('restart', function () {
/*eslint no-console: ['error', { allow: ['warn', 'log'] }] */
console.log('>>>>>>> nodemon app is restarting <<<<<<<<');
});
});
gulp.task('restart-server', function () {
appServer.restart();
});
gulp.task('refresh-page', ['build', 'build-page'], function () {
livereload.changed('src/index.js');
});
gulp.task('watch', ['serve'], function () {
livereload.listen({ port: process.env.LIVERELOAD_PORT });
gulp.watch(['./**/*.scss', './demos/**/*'], ['refresh-page']);
gulp.watch('./*.*', ['restart-server']);
});
gulp.task('dev-add-livereload', function () {
process.env.DEV_ADD_LIVERELOAD = true;
});
gulp.task('default', ['build', 'build-page']);
gulp.task('dev');