Skip to content

Commit e18e2f7

Browse files
committed
init build with grunt docs
1 parent 475b43b commit e18e2f7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/contrib/build-with-grunt.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# 使用 grunt 构建
2+
3+
- pubdate: 2013-04-11
4+
- author: lepture
5+
6+
-----
7+
8+
## 构建的过程
9+
10+
构建一般分为以下三部分:
11+
12+
### transport
13+
14+
Transport 是将信息不完备的模块转换为信息完备的模块的过程,比如:
15+
16+
```js
17+
// foo.js
18+
define(function(require, exports, module) {
19+
require('./bar')
20+
})
21+
```
22+
23+
经过 transport 后,变为:
24+
25+
```js
26+
// foo.js
27+
define('foo', ['./bar'], function(require, exports, module) {
28+
require('./bar')
29+
})
30+
```
31+
32+
我们可使用 [grunt-cmd-transport](https://github.com/spmjs/grunt-cmd-transport) 来做 transport。
33+
34+
35+
### concat
36+
37+
Concat 是合并文件的过程,将一系列文件打包在一起。
38+
39+
我们可使用 [grunt-cmd-concat](https://github.com/spmjs/grunt-cmd-concat) 来做 concat。
40+
41+
42+
### minify
43+
44+
minify 是压缩代码的过程。
45+
46+
我们可使用 [grunt-contrib-uglify](https://github.com/gruntjs/grunt-contrib-uglify) 来做 minify。
47+
48+
## 如何构建
49+
50+
我们使用 grunt 做为构建工具,加上相应的 Task 就能构建出我们想要的模块。

0 commit comments

Comments
 (0)