-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (55 loc) · 1.47 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
var gulp = require('gulp')
, browserify = require('gulp-browserify')
, uglify = require('gulp-uglify')
, rename = require('gulp-rename')
, less = require('gulp-less')
, livereload = require('gulp-livereload')
, notify = require('gulp-notify')
, plumber = require('gulp-plumber')
, path = require('path')
;
gulp.task('css', function () {
return gulp.src('client/less/app.less')
.pipe(plumber({errorHandler: notify.onError({
title: 'ERROR',
message: '<%= error.message %>',
icon: 'assets/less.png'
})}))
.pipe(less({
paths: ['./node_modules/material-ui/src/less/'],
compress: true
}))
.pipe(gulp.dest('client/build/css'))
.pipe(notify({
title: 'SUCCESS',
icon: 'assets/less.png'
}))
.pipe(livereload())
;
})
gulp.task('js', function () {
return gulp.src('client/js/index.js')
.pipe(plumber({errorHandler: notify.onError({
title: 'ERROR',
message: '<%= error.message %>',
icon: 'assets/js.png'
})}))
.pipe(browserify())
.pipe(uglify())
.pipe(rename('app.js'))
.pipe(gulp.dest('client/build/js'))
.pipe(notify({
title: 'SUCCESS',
icon: 'assets/js.png'
}))
.pipe(livereload())
;
});
gulp.task('watch', function () {
livereload.listen();
console.log('Now listening for changes...');
gulp.watch(['client/js/**/*.js'], ['js']);
gulp.watch(['client/sass/**/*.scss'], ['css']);
})
gulp.task('default', ['watch', 'js', 'css'], function () {
});