-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
32 lines (27 loc) · 998 Bytes
/
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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var plumber = require('gulp-plumber')
var notifier = require('node-notifier');
function errorHandler(err) {
var list = err.message.split(':')
var head = list.shift()
var body = list.join(':')
var paths = head.split('/')
console.log(err.message)
notifier.notify({title: paths[paths.length - 1], message: body})
}
notifier.notify({title: 'gulp', message: 'start'})
gulp.task('build', function() {
gulp.src( 'source/*.html' ).pipe( gulp.dest( 'build' ) )
gulp.src( 'source/images/**' ).pipe( gulp.dest( 'build/images' ) )
gulp.src( 'source/stylesheets/**' ).pipe( gulp.dest( 'build/stylesheets' ) )
gulp.src('./source/*.js')
.on('error', errorHandler)
.pipe($.babel({presets: ['es2015', 'react']}))
.pipe(plumber({errorHandler: errorHandler}))
.pipe(gulp.dest('./build'))
})
gulp.task('watch', function() {
gulp.watch('./source/*', ['build'])
})
gulp.task('default', ['build', 'watch'])