-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
43 lines (38 loc) · 1.2 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
const gulp = require('gulp')
const sass = require('gulp-sass')
const plumber = require('gulp-plumber')
const browserify = require('browserify')
const babelify = require('babelify')
const vinylBuffer = require('vinyl-buffer')
const vinylSourceStream = require('vinyl-source-stream')
const notify = require('gulp-notify')
const stats = require('gulp-stats')(gulp)
const clean = require('gulp-clean')
function onError(err) {
notify.onError({
title: 'Gulp',
subtitle: 'Compilation Error',
message: 'Error <%= error.message %>',
sound: 'Beep'
})(err)
this.emit('end')
}
gulp.task('javascript', () =>
browserify({ entries: 'lib/javascript/index.js' })
.transform(babelify, { presets: ['es2015'], plugins: ['transform-class-properties', 'transform-object-assign'] })
.bundle()
.on('error', onError)
.pipe(vinylSourceStream('sharetastic.js'))
.pipe(vinylBuffer())
.pipe(gulp.dest('dist'))
)
gulp.task('sass', () =>
gulp.src('lib/stylesheets/sharetastic.sass')
.pipe(gulp.dest('dist'))
.pipe(sass())
.pipe(gulp.dest('dist'))
)
gulp.task('watch', () => {
gulp.watch('lib/javascript/**/*.js', ['javascript'])
})
gulp.task('default', ['javascript', 'sass', 'watch'])