Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,30 @@ fis 中对依赖的js 加载,尤其是异步 js,需要一个 js loader。
- `includeAsyncs` 默认为 false。all in one 打包,是不包含异步依赖的,不过可以通过把此属性设置成 true,包含异步依赖。
- `ignore` 默认为空。如果不希望部分文件被 all in one 打包,请设置 ignore 清单。
- `sourceMap` 默认为 `false`。是否生成 sourcemap.
- `useTrack` 默认为 `true`. 是否在打包文件中添加track信息
 - `useTrack` 默认为 `true`。 是否在打包文件中添加track信息
- `attrs` 默认为空。all in one 打包后 `script/link` 的属性自定义。如:  
```javascript
// <script type="text/javascript" myattr="xxxx" src="xxxx">
// <link rel="stylesheet" type="text/css" myattr="xxxx" href="xxxx">
postpackager: fis.plugin('loader', {
allInOne: {
attrs: 'myattr="xxxx"',
}
})

// 或者
// <script type="text/javascript" crossorigin="anonymous" src="xxxx">
// <link rel="stylesheet" type="text/css" cssattr="xxxx" href="xxxx">
postpackager: fis.plugin('loader', {
allInOne: {
attrs: function (orignAttr, url) {
if (orignAttr.match(/text\/javascript/)) return orignAttr + ' crossorigin="anonymous"';
if (orignAttr.match(/text\/css/)) return orignAttr + ' cssattr="xxxx"';
return orignAttr;
},
}
})
```

* `processor` 默认为 `{'.html': 'html'}`, 即支持后缀是 .html 的文件,如果要支持其他后缀,请在此扩展。

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ rudePackager.defaultOptions = {
css: '', // 打包后 css 的文件路径。
js: '', // 打包后 js 的文件路径。
includeAsyncs: false, // 可以配置成 true 用来包含异步依赖。
ignore: null // 忽略列表,可以配置部分文件不被 all in one.
ignore: null, // 忽略列表,可以配置部分文件不被 all in one.
// attrs:
// 打包后 css/js 的自定义属性,
// 比如:crossorigin="anonymous"。
Expand Down