nui-concat
Version:
Nui框架模块文件合并插件
54 lines (46 loc) • 1.47 kB
Markdown
## Installation
Install package with NPM and add it to your development dependencies:
`npm install --save-dev nui-concat`
## Usage
```js
var nuiconcat = require('nui-concat');
gulp.task('nuiconcat', function(){
return gulp.src('./pages/*.html')
.pipe(nuiconcat({
paths:{
base:__dirname+'/'
},
alias:{
'common':'{base}libs/common.js'
},
ignore:[
'placeholder'
]
}))
});
```
## Information
插件会匹配页面中的Nui.load(入口模块, callback),将所有的依赖模块合并,并在入口模块同目录生成“入口模块-debug.js”
## Options
<table>
<tr>
<th>参数</th>
<th>类型</th>
<th>说明</th>
</tr>
<tr>
<td>paths</td>
<td>Object {别名:路径,别名:路径,..}</td>
<td>路径别名,和Nui.config中的paths对应,若别名中存在base,则其它别名路径都会被重新设置为base路径+别名路径</td>
</tr>
<tr>
<td>alias</td>
<td>Object {别名:路径,别名:路径,..}</td>
<td>模块别名,和Nui.config中的alias对应,值中可以通过{别名}访问paths中的别名路径</td>
</tr>
<tr>
<td>ignore</td>
<td>Array [模块名,模块名,..]</td>
<td>忽略模块不会被添加到合并文件中,默认值['util', 'template', 'component'],这三个模块已经在nui.js中添加了</td>
</tr>
</table>