-
Notifications
You must be signed in to change notification settings - Fork 46
/
gulpfile.js
63 lines (63 loc) · 1.72 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
/*
* Created with Sublime Text 2.
* license: http://www.lovewebgames.com/jsmodule/index.html
* User: 田想兵
* Date: 2015-04-27
* Time: 15:15:51
* Contact: 55342775@qq.com
*/
var gulp = require('gulp'),
rjs = require('gulp-requirejs'),
uglify = require('gulp-uglify'),
cssmin = require('gulp-minify-css'),
concat = require('gulp-concat'),
watchF = require('gulp-watch');
var paths = {
script: 'src/*.js',
css: 'src/*.css'
};
gulp.task('js', function () {
return gulp.src(['src/query.js', 'src/paging.js']).pipe(concat('paging.js')).pipe(uglify()).pipe(gulp.dest('dist'))
.pipe(gulp.dest('docs'));
});
gulp.task('css', function () {
return gulp.src(paths.css)
.pipe(cssmin({
compatibility: 'ie8'
})) //兼容ie
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('dest'))
.pipe(gulp.dest('docs'));
});
gulp.task('requirejs', function () {
return rjs({
"name": "paging",
"baseUrl": "src",
"out": "paging.js",
shim: {
'$': {
exports: '_'
}
},
"paths": {
$: "jquery-1.11.2"
},
exclude: ["$"],
//这里不打包zepto
// map: {
// "*": {
// "$": "jquery-private"
// },
// "jquery-private": {}
// }
// ... more require.js options
}).pipe(uglify())
.pipe(gulp.src(['src/jquery-1.11.2.js', 'src/require.js']).pipe(uglify()))
.pipe(gulp.dest('dest')); // pipe it to the output DIR
});
gulp.task('watch', function () {
watchF(['src/*.*', 'html/*.*'], function () {
gulp.start('default')
});
});
gulp.task('default', ['js', 'css','requirejs']);