-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (41 loc) · 1.2 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
const { src, dest, watch, series } = require('gulp');
const stylus = require('gulp-stylus');
const nodemon = require('gulp-nodemon');
const rimraf = require('rimraf');
const util = require('util');
function styl() {
return src(['app/assets/stylesheets/application.styl', 'app/assets/stylesheets/personal.styl'])
.pipe(stylus())
.pipe(dest('public/assets/stylesheets'))
}
function images() {
return util.promisify(rimraf)('public/assets/images')
.then(() => {
return src('app/assets/images/**/*')
.pipe(dest('public/assets/images'));
});
}
exports.stylus = stylus;
exports.images = images;
exports.build = series(styl, images);
exports.watch = function(cb) {
nodemon({
script: 'app.js',
env: { 'NODE_ENV': 'development' },
ext: 'js pug json',
watch: [
'app.js',
'app/controllers/',
'app/helpers/',
'app/models/',
'app/views/',
'config/',
'db/',
'utils/'
],
done: cb
});
// TODO: При первом запуске dev сервера не происходит сборки стилей и изображений
watch('app/assets/stylesheets/**/*.styl', styl);
watch('app/assets/images/**/*', images);
};