-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile1
118 lines (103 loc) · 4.47 KB
/
gruntfile1
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// @charset "utf-8";
module.exports = function (grunt) {
var transport = require('grunt-cmd-transport');
// var text = transport.text.init(grunt);
var script = transport.script.init(grunt);
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
transport : {
options : {
paths : ['../'],
alias : '<%= pkg.spm.alias %>',
debug : false,
parsers : {
'.js' : [script.jsParser]
}
},
app : {
files : [
{
expand :true,
cwd : '../',
src : ['center/js/static/**', 'center/js/sea-modules/**/*-debug.js', '!center/js/static/bootstrap/**', '!center/js/static/configs/**'],
dest : '.build'
}
]
}
},
concat : {
options : {
paths : ['.build/'],
include : 'relative'
},
app : {
options : {
include : 'all'
},
files : [
{
expand : true,
cwd : '.build/',
filter : 'isFile',
src : ['center/js/static/apps/*'],
dest : 'built/',
ext : '.js'
}
]
}
},
uglify : {
options : {
mangle : {
except : ['require']
}
},
app : {
files : [
{
expand : true,
cwd : './built/center/js/static/apps/',
src : ['*.js'],
dest : 'built/uglify/',
}
]
}
},
clean : {
// spm : ['.build']
}
});
grunt.loadNpmTasks('grunt-cmd-transport');
grunt.loadNpmTasks('grunt-cmd-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
// 写入sea.js和启动代码
grunt.registerTask('concatseajslibfile', 'concat sea.js and bootstrap code', function () {
var seajsfile = grunt.file.read('./js/sea-modules/seajs/seajs/2.1.0/sea.js');
var bootstrapOfFmlist = grunt.file.read('./js/static/bootstrap/fmlist.js');
var mainFmlist = grunt.file.read('./built/center/js/static/apps/fmlist.js');
var finalFmlist = seajsfile + mainFmlist + bootstrapOfFmlist;
grunt.file.write('./built/center/js/static/apps/fmlist.js', finalFmlist);
var bootstrapOfFmdetail = grunt.file.read('./js/static/bootstrap/fmdetail.js');
var mainFmdetail = grunt.file.read('./built/center/js/static/apps/fmdetail.js');
var finalFmdetail = seajsfile + mainFmdetail + bootstrapOfFmdetail;
grunt.file.write('./built/center/js/static/apps/fmdetail.js', finalFmdetail);
var bootstrapOfSsresult = grunt.file.read('./js/static/bootstrap/ssresult.js');
var mainSsresult = grunt.file.read('./built/center/js/static/apps/ssresult.js');
var finalSsresult = seajsfile + mainSsresult + bootstrapOfSsresult;
grunt.file.write('./built/center/js/static/apps/ssresult.js', finalSsresult);
var bootstrapOfUploadfm = grunt.file.read('./js/static/bootstrap/uploadfm.js');
var mainUploadfm = grunt.file.read('./built/center/js/static/apps/uploadfm.js');
var finalUploadfm = seajsfile + mainUploadfm + bootstrapOfUploadfm;
grunt.file.write('./built/center/js/static/apps/uploadfm.js', finalUploadfm);
var bootstrapOfMyupload = grunt.file.read('./js/static/bootstrap/myupload.js');
var mainMyupload = grunt.file.read('./built/center/js/static/apps/myupload.js');
var finalMyupload = seajsfile + mainMyupload + bootstrapOfMyupload;
grunt.file.write('./built/center/js/static/apps/myupload.js', finalMyupload);
var bootstrapOfJsandcssDebug = grunt.file.read('./js/static/bootstrap/jsandcss.js');
var mainJsandcssDebug = grunt.file.read('./built/center/js/static/apps/jsandcss-debug.js');
var finalJsandcssDebug = seajsfile + mainJsandcssDebug + bootstrapOfJsandcssDebug;
grunt.file.write('./built/center/js/static/apps/jsandcss-debug.js', finalJsandcssDebug);
});
grunt.registerTask('build', ['transport:app', 'concat:app', 'concatseajslibfile','uglify', 'clean']);
};