forked from kenwheeler/slick
-
Notifications
You must be signed in to change notification settings - Fork 48
/
gulpfile.js
37 lines (32 loc) · 1.07 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
var gulp = require('gulp');
var uglifyJS = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var minifyCSS = require('gulp-clean-css');
var del = require('del');
// Remove old files
gulp.task('clean', function() {
return del(['slick/*.min.*']);
});
// Build the CSS
gulp.task('build:css', function() {
return gulp.src(['slick/*.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(minifyCSS())
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest('slick'));
});
// Build the JavaScript
gulp.task('build:js', function() {
return gulp.src(['slick/slick.js'])
.pipe(uglifyJS())
.pipe(rename('slick.min.js'))
.pipe(gulp.dest('slick'));
});
// Watch source files for changes and automatically rebuild them when change are saved
gulp.task('watch', function() {
gulp.watch('slick/*.scss', gulp.series(['build:css']));
gulp.watch(['slick/*.js', '!slick/*.min.js'], gulp.series(['build:js']));
});
// Default task executes a fresh build of custom JS
gulp.task('default', gulp.series('clean','build:js','build:css'));