Glob 语法

Glob 通常用来匹配 file, gitignore, Tailwind CSS purge 都有用到

参考:

Online Test Tool

语法解释

常用到的 

./PdfTemplate/**/!(Index).cshtml

双 ** 就是不管多少层 folder

! 是取反

上面这个匹配的就是 starts with ./PdfTemplate/ 然后不管多少层 folder, 里面除了 Index 之外 ends with .cshtml 的 file

'./Web/**/!(*Amp*|Index).cshtml'

单 * 就是匹配 whatever *Amp* 就是前后是 whatever 中间是 AMP

| 就是或者 

上面这个匹配就是 starts with ./Web/ 不管多少层 folder, ends with .cshtml 同时, 不是 Index, 也不是包含 AMP 的 file

'./Web/**/*Amp!(*Index).cshtml'

whatever Amp 紧接着不等于 whatever Index, 这样也是 ok 的哦

 

posted @ 2021-10-10 16:57  兴杰  阅读(157)  评论(0编辑  收藏  举报