4
我使用的咕嚕咕嚕的文件列表,我想複製我的涼亭依賴創建生產分發閱讀涼亭相依爲
這些依賴於./components已經存在時
我產生一個生產目錄中index.html裏面,只想複製bower.json文件中的依賴關係。
我認爲這將是作爲產生從DEPS列表作爲簡單:
prodComponents = Object.keys(grunt.file.readJSON('./bower.json').dependencies)
(其從一個簡單的console.log產生(prodComponents)
[ 'requirejs',
'requirejs-text',
'jquery',
'underscore-amd',
'backbone-amd',
'backbone.wreqr',
'backbone.babysitter',
'marionette' ]
,然後簡單地複製匹配文件:
copy:
deps:
files: [
expand: true
cwd: './components'
src: ['./<%= prodComponents %>/*']
dest: './dev/components'
]
這個工程,但複製所有組件。即我的文件規範失敗
Running "copy:deps" (copy) task
Created 15 directories
如果我刪除了./那麼它失敗:
Warning: Unable to read "components/Applications" file (Error code: ENOENT). Use --force to continue.
不禁覺得我既想成爲太聰明,或與此接近那裏。
我在做什麼錯誤的文件規範的規範?
謝謝
不像我最初設想的那樣簡潔,但是很有用。謝謝 – Joe
供參考:prodComponent +「/ *」應該是prodComponent +「/ **/*」來捕獲子目錄。 – Joe
@Joe固定,謝謝! –