-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
42 lines (37 loc) · 1.01 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
const gulp = require('gulp');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const webserver = require('gulp-webserver');
const plumber = require('gulp-plumber');
gulp.task('sass', function () {
return gulp.src('./src/combobox.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(cleanCSS())
.pipe(gulp.dest('./dist'));
});
gulp.task('js', () => {
return gulp.src('src/combobox.js')
.pipe(plumber())
.pipe(babel({
presets: ['es2015']
}))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function () {
gulp.watch('./src/*.js', ['js']);
gulp.watch('./src/*.scss', ['sass']);
});
gulp.task('serve', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: '/example.html'
}));
});
gulp.task('default', ['watch', 'serve']);