-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
64 lines (53 loc) · 1.73 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
process.env.DISABLE_NOTIFIER = true;
/**
* Created by j on 14.08.15.
*/
var gulp = require('gulp'),
sass = require('gulp-sass'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
del = require('del');
gulp.task('styles', function() {
return gulp.src('web/css/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('web/css/assets'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('web/css/assets'))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('scripts', function() {
return gulp.src('web/js/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('main.js'))
.pipe(gulp.dest('web/js/assets'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('web/js/assets'))
.pipe(notify({ message: 'Scripts task complete' }));
});
gulp.task('clean', function(cb) {
del(['web/css/assets', 'web/js/assets'], cb)
});
gulp.task('watch', function() {
// Watch .scss files
gulp.watch('web/css/**/*.scss', ['styles']);
// Watch .js files
gulp.watch('web/js/*.js', ['scripts']);
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts');
});
gulp.task('watch', function() {
// Create LiveReload server
livereload.listen();
// Watch any files in dist/, reload on change
gulp.watch(['dist/**']).on('change', livereload.changed);
});