-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
46 lines (40 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
43
44
45
46
var gulp = require('gulp'),
clean = require('gulp-clean'),
uglify = require('gulp-uglify'),
gulpsync = require('gulp-sync')(gulp),
replace = require('gulp-replace'),
fs = require('fs'),
PROJECT,
DATE;
gulp.task('clean', function() {
return gulp.src(['dist', 'index.html'], {
read: false
})
.pipe(clean({
force: true
}));
});
gulp.task('build-dist', function() {
return gulp.src('src/color.js')
.pipe(uglify())
.pipe(gulp.dest('dist/'));
});
gulp.task('make-gh-pages', function() {
return gulp.src('demo/index.html')
.pipe(replace('%_VERSION_%', PROJECT.version))
.pipe(replace('%_DATE_%', DATE.toUTCString()))
.pipe(gulp.dest('.'));
});
gulp.task('init', function () {
PROJECT = JSON.parse(fs.readFileSync('./package.json'));
DATE = new Date();
});
gulp.task('build', gulpsync.sync([
'init',
'clean',
'build-dist'
]));
gulp.task('gh-pages', gulpsync.sync([
'build',
'make-gh-pages'
]));