forked from callmecavs/layzr.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
44 lines (38 loc) · 1.03 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
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var notifier = require('node-notifier');
// error handler
// system notification, console log, emit end (so watch continues)
var onError = function(error) {
notifier.notify({
'title': 'Error',
'message': 'Compilation failure.'
});
console.log(error);
this.emit('end');
}
// concat and uglify scripts
gulp.task('scripts', function() {
return gulp.src('dist/layzr.js')
.pipe(plugins.plumber({ errorHandler: onError }))
.pipe(gulp.dest('dist'))
.pipe(plugins.uglify())
.pipe(plugins.rename(function(path) {
path.basename = "layzr.min"
}))
.pipe(gulp.dest('dist'));
});
// start local server on port 3000
gulp.task('server', function() {
return plugins.connect.server({
root: './',
port: 3000,
livereload: true
});
});
// watch sass and js files
gulp.task('watch', function() {
gulp.watch('dist/layzr.js', ['scripts']);
});
// build and default task
gulp.task('default', ['server', 'scripts', 'watch']);