How do I mix copy multiple files with Elixir?
This does not work:
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']
]);
Any other suggestions except:
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');
The problem is that mix.copy()
expect two strings so passing an array will not work. I fixed it by creating an object called directories like this:
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'
}
Then we can loop on that object like this:
for (directory in directories) {
mix.copy(directory, directories[directory]);
}
This should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With