![](/img/trans.png)
[英]Grunt Files Object Format: All regular files files immediately under top level directory
[英]Copy all files under specific directory name format in Grunt?
我在整個應用程序的 t9n 目錄下都有翻譯文件……在某些組件目錄等中。
app
components
ComponentA
t9n
translations_A.json
ComponentB
t9n
translations_B.json
t9n
common-translations.json
而且我正在尋找創建一個繁重的任務來在構建應用程序時將所有這些.json 文件復制到assets
目錄中。
有沒有辦法獲取特定目錄名稱下的所有內容? 所以我可以說....對於 app 下的每個目錄,獲取任何t9n
目錄的內容?
我知道你可以做一些事情,比如......
"**/*.{png}"
表示復制所有 PNG 文件....但不確定上面的內容是什么。
答案就像評論中提到的那樣, "app/**/t9n/*.json
特別是我對 Grunt https://gruntjs.com/configuring-tasks#globbing-patterns的通配模式感到困惑
我最終使用了 grunt 文檔https://gruntjs.com/configuring-tasks#files-array-format中的文件數組格式
最后得到了這樣的東西......
"build-t9n": {
files: [
{
cwd: "src/app/js",
src: ["**/t9n/*.json"],
dest: "build/assets/t9n",
expand: true
}
]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.