Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正了关于node-glob match pattern的一个描述错误 #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions doc/docs/api/config-glob.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ FIS3 中支持的 glob 规则,FIS3 使用 [node-glob](https://github.com/isaac
当设置规则时,没有严格的以 `/` 开头,比如 `a.js`, 它匹配的是所有目录下面的 `a.js`, 包括:`/a.js`、`/a/a.js`、`/a/b/a.js`。 如果要严格只命中根目录下面的 `/a.js`, 请使用 `fis.match('/a.js')`。

另外 `/foo/*.js`, 只会命中 `/foo` 目录下面的所有 js 文件,不包含子目录。
而 `/foo/**/*.js` 是命中所有子目录以及其子目录下面的所有 js 文件,不包含当前目录下面的 js 文件。
如果需要命中 `foo` 目录下面以及所有其子目录下面的 js 文件,请使用 `/foo/**.js`。
而 `/foo/**/*.js` 是命中 `foo` 目录下面以及所有其子目录下面的 js 文件。
FIS3扩展了这块的语法,除了使用`node-glob`的`/foo/**/*.js`, 也可以使用 `/foo/**.js`。


### 扩展的规则

1. 假设匹配 `widget` 目录下以及其子目录下的所有 js 文件,使用 `node-glob` 需要这么写

```js
widget/**/*.js
或者
widget/{*.js,**/*.js}
```

Expand Down