我有一个项目,其中包括许多供应商的 javascript,例如 jQuery。我将这些脚本作为 git 子模块包含在内。但是,对于我的构建过程,我需要构建的脚本,而不是该脚本的整个存储库。所以我试图设置一个 rake 任务来构建每个脚本 - 最好使用脚本自己的 rakefile - 然后将构建的脚本复制到我的资产目录中。
file "app/vendor/scriptname.js" do
# Call the task that builds the script here
sh "cp app/vendor/script-submodule/dist/scriptname.js app/vendor/"
end
desc "Make vendor scripts available for build"
task :vendor => "app/vendor/scriptname.js" do
end
如果我import 'app/vendor/scriptname/Rakefile'
在我的 Rakefile 中使用,我应该可以访问构建脚本的 rake 任务,对吧?我该怎么称呼它?还是我应该使用sh "cd app/vendor/script-submodule/ && rake dist"
并称其为好?