-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
65 lines (65 loc) · 1.84 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
/*
* 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'),
watchF = require('gulp-watch');
var paths = {
script: 'src/*.js',
css: 'src/*.css'
};
gulp.task('js', function() {
return gulp.src(paths.script).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('docs'))
.pipe(gulp.dest('dest'));
});
gulp.task('requirejs', function() {
return rjs({
"name": "autosearch",
"baseUrl": "src",
"out": "autosearch.js",
shim: {
'$': {
exports: '_'
}
},
"paths": {
$:"jquery-1.11.2",
handlebars:"handlebars-v3.0.0",
paging:'paging',
query:'query',
'dialog':'dialog'
},
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']);