4

如何使用 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');
4

1 回答 1

7

问题是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]);
}

这应该有效。

于 2015-08-04T21:06:11.563 回答