-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
88 lines (74 loc) · 2.15 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
80
81
82
83
84
85
86
87
88
"user strict";
var gulp = require('gulp'),
bower = require('gulp-bower'),
jshint = require('gulp-jshint'),
refresh = require('gulp-livereload'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
client = require('tiny-lr')(),
list = require('gulp-task-listing'),
nodemon = require('gulp-nodemon'),
lr_port = 35729,
sass = require('gulp-sass');
var paths = {
scripts: ['!client/lib/**/*.js', 'client/**/*.js'],
views: ['!client/lib/*.html', 'client/**/*.html', 'client/index.html'],
styles: {
css: ['!client/lib/**/*.css', 'client/styles/css/*.css', 'client/**/*.css'],
sass: ['client/styles/sass/*.scss', 'client/**/*.scss'],
dest: 'client/styles/css'
}
};
var build = ['sass', 'css', 'lint'];
gulp.task('sass', function () {
return gulp.src(paths.styles.sass)
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest(paths.styles.dest))
.pipe(refresh(client))
.pipe(notify({message: 'Sass done'}));
});
gulp.task('bowerInstall', function () {
bower()
.pipe();
});
gulp.task('html', function () {
return gulp.src(paths.views)
.pipe(plumber())
.pipe(refresh(client))
.pipe(notify({message: 'Views refreshed'}));
});
gulp.task('css', function () {
return gulp.src(paths.styles.css)
.pipe(plumber())
.pipe(refresh(client))
.pipe(notify({message: 'CSS refreshed'}));
});
gulp.task('lint', function () {
return gulp.src(paths.scripts)
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(refresh(client))
.pipe(notify({message: 'Lint done'}));
});
gulp.task('serve', function () {
nodemon({script: 'server/server.js', ignore: ['node_modules/**/*.js']})
.on('restart', function () {
refresh(client);
});
});
gulp.task('live', function () {
client.listen(lr_port, function (err) {
if (err) {
return console.error(err);
}
});
});
gulp.task('watch', function () {
gulp.watch(paths.styles.sass, ['sass']);
gulp.watch(paths.views, ['html']);
gulp.watch(paths.scripts, ['lint']);
});
gulp.task('build', build);
gulp.task('default', ['build', 'live', 'serve', 'watch']);