This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
76 lines (71 loc) · 1.67 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const gulp = require('gulp');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const plumber = require('gulp-plumber');
const pump = require('pump');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer');
const concat = require('gulp-concat');
function buildJQuery() {
pump([
plumber({
errorHandler: function(err) {
console.log(err);
this.emit('end');
}
}),
gulp.src([
'src/jquery.js'
]),
concat('main.js'),
uglify(),
rename('zoombox.jquery.min.js'),
gulp.dest('dist/')
])
}
gulp.task('build-jQuery',buildJQuery);
function buildPlain() {
// pump([
// plumber({
// errorHandler: function(err) {
// console.log(err);
// this.emit('end');
// }
// }),
// gulp.src('src/plain.js'),
// uglify(),
// rename('zoombox.min.js'),
// gulp.dest('dist/')
// ])
}
gulp.task('build-plain',buildPlain);
function buildCss() {
pump([
plumber({
errorHandler: function(err) {
console.log(err);
this.emit('end');
}
}),
gulp.src([
'src/styles.scss'
]),
concat('main.scss'),
sass(),
cleanCSS(),
autoprefixer({
browsers: ['last 5 versions'],
cascade: false
}),
rename('zoombox.min.css'),
gulp.dest('dist/')
])
}
gulp.task('build-css',buildCss);
gulp.task('build', ['build-jQuery','build-plain','build-css'])
gulp.task('default', ['build'], function() {
gulp.watch('src/jquery.js',['build-jQuery']);
gulp.watch('src/plain.js',['build-plain']);
gulp.watch('src/styles.scss',['build-css']);
});