-
Notifications
You must be signed in to change notification settings - Fork 20
/
gulpfile.js
44 lines (41 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
44
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const uglify = require('gulp-uglify');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const babel = require('gulp-babel');
const autoprefixer = require('gulp-autoprefixer');
gulp.task('scripts', () => {
return gulp.src('src/vertical-timeline.js')
.pipe(plumber(plumber({
errorHandler: function (err) {
console.log(err);
this.emit('end');
}
})))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'))
.pipe(uglify({
preserveComments: 'license'
}))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('dist'));
});
gulp.task('styles', () => {
return gulp.src('src/vertical-timeline.scss')
.pipe(plumber(plumber({
errorHandler: function (err) {
console.log(err);
this.emit('end');
}
})))
.pipe(sass())
.pipe(autoprefixer())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', ['scripts', 'styles'], function() {
gulp.watch('src/*.js', ['scripts']);
gulp.watch('src/*.scss', ['styles']);
});