-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathgulpfile.js
executable file
·53 lines (44 loc) · 1.08 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
var gulp = require('gulp');
var clean = require('gulp-clean');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var staticHash = require('gulp-static-hash');
var paths = {
src : 'src',
dist: 'dist'
};
var pcFile = [
paths.src + '/lib/exif.js',
paths.src + '/lrz.js'
];
var mobileFile = [
paths.src + '/lib/exif.js',
paths.src + '/lib/mobileFix.mini.js',
paths.src + '/lrz.js'
];
// pc
gulp.task('pc', function () {
gulp.src(pcFile)
.pipe(uglify())
.pipe(concat('lrz.pc.min.js'))
.pipe(gulp.dest(paths.dist));
});
// pc
gulp.task('mobile', function () {
gulp.src(mobileFile)
.pipe(uglify())
.pipe(concat('lrz.mobile.min.js'))
.pipe(gulp.dest(paths.dist));
});
// 清洁工作
gulp.task('clean', function () {
gulp.src(paths.dist)
.pipe(clean({force: true}));
});
// 更新缓存
gulp.task('hash', function () {
gulp.src('./**/*.html')
.pipe(staticHash({asset: 'static'}))
.pipe(gulp.dest('./'));
});
gulp.task('default', ['clean', 'hash', 'pc', 'mobile']);