gpt4 book ai didi

node.js - GruntJS 递归 globbing 区别

转载 作者:搜寻专家 更新时间:2023-10-31 23:24:51 25 4
gpt4 key购买 nike

**/*.js{,*/}*.js 在 GruntJS Node 通配中有什么区别?

最佳答案

GruntJS 使用 globbing patterns基于 node-glob图书馆。

基于此,*将具有以下含义:

  • path/* - path 中的所有文件和文件夹递归
  • path/** - path 中的所有内容递归
  • path/*.* - 名称中包含点的所有文件和文件夹;匹配 file.txt.gitignorenoExtension.

为了说明一些问题,您可以在 glob patterns 上阅读这篇文章.

在文档中他们有 Glob Primer ,其中有一个例子:

Before parsing the path part patterns, braced sections are expanded into a set. Braced sections start with { and end with }, with any number of comma-delimited sections within. Braced sections may contain slash characters, so a{/b/c,bcd} would expand into a/b/c and abcd.

这正是您的案例 {,*/}*.js 的内容。

我强烈建议使用语法 **(在你的例子中是 **/*.js,用于过滤 .js仅文件)当您需要递归迭代路径时。

关于node.js - GruntJS 递归 globbing 区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30561001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com