forked from evenfrost/exadus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
79 lines (72 loc) · 1.63 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
68
69
70
71
72
73
74
75
76
77
78
79
var gulp = require('gulp'),
changed = require('gulp-changed'),
stylus = require('gulp-stylus'),
nib = require('nib'),
nodemon = require('gulp-nodemon'),
livereload = require('gulp-livereload'),
plumber = require('gulp-plumber'),
runSequence = require('run-sequence'),
del = require('del'),
stylesAssetsPath = 'client/styles/**/*.styl',
stylesPublicPath = 'public/styles',
scriptsAssetsPath = 'client/scripts/**/*.js',
scriptsPublicPath = 'public/scripts';
/**
* Styles.
*/
gulp.task('styles', function () {
return gulp.src(stylesAssetsPath)
.pipe(plumber())
.pipe(changed(stylesPublicPath))
.pipe(stylus({
use: [nib()],
import: ['nib']
}))
.pipe(gulp.dest(stylesPublicPath))
.pipe(livereload());
});
/**
* Scripts.
*/
gulp.task('scripts', function () {
return gulp.src(scriptsAssetsPath)
.pipe(plumber())
.pipe(changed(scriptsPublicPath))
.pipe(gulp.dest(scriptsPublicPath))
.pipe(livereload());
});
/**
* Watchers.
*/
gulp.task('watch', function () {
livereload.listen();
gulp.watch(stylesAssetsPath, ['styles']);
gulp.watch(scriptsAssetsPath, ['scripts']);
});
/**
* Cleaners.
*/
gulp.task('clean', function (cb) {
del([
scriptsPublicPath,
stylesPublicPath
], cb);
});
/**
* Development helpers.
*/
gulp.task('dev', function () {
nodemon({
script: 'bin/www',
ext: 'js jade',
ignore: ['client/**', 'public/**']
})
.on('start', ['watch'])
.on('change', ['watch']);
});
/**
* Default task.
*/
gulp.task('default', function (callback) {
runSequence('clean', ['styles', 'scripts'], 'dev', callback);
});