如何将多个文件与Elixir混合复制?
这不起作用:
mix.copy([
['node_modules/vue/dist/vue.js', 'resources/assets/js/vendor/vue.js'],
['node_modules/vue-resource/dist/vue-resource.js', 'resources/assets/js/vendor/vue-resource.js']
]);
除了以下任何其他建议:
mix.copy('node_modules/vue/dist/vue.js', 'resources/assets/js/vendor/vue.js');
mix.copy('node_modules/vue-resource/dist/vue-resource.js', 'resources/assets/js/vendor/vue-resource.js');
答案 0 :(得分:6)
问题是mix.copy()
期望两个字符串,所以传递一个数组是行不通的。我通过创建一个名为目录的对象来修复它:
var directories = {
'node_modules/vue/dist/vue.js': 'resources/assets/js/vendor/vue.js',
'node_modules/vue-resource/dist/vue-resource.js': 'resources/assets/js/vendor/vue-resource.js'
}
然后我们可以像这样循环该对象:
for (directory in directories) {
mix.copy(directory, directories[directory]);
}
这应该有用。