Laravel Mix – A Weblog of Priyank Maniar https://priyank.rocks Articles on web development & mobile app development Sat, 22 May 2021 17:46:14 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 Laravel Mix: How to output separate files rather than a combined one? https://priyank.rocks/laravel-mix-how-to-output-separate-files-rather-than-a-combined-one/ Fri, 27 Apr 2018 16:07:46 +0000 http://priyank.rocks/?p=121 Update the path as per your setup. The following is tested on Laravel 5.6.

1
2
3
4
5
6
var fs = require('fs');
var vueFiles = fs.readdirSync('resources/assets/frontend/js/vue');

for(var i = 0; i < vueFiles.length; i++) {
    mix.js('resources/assets/frontend/js/vue/'+vueFiles[i], 'public/assets/frontend/js/output_vue/output_'+ vueFiles[i]);
}
]]>