Reputation: 21
I'm using a theme, which uses Laravel Mix to compile scss and minimize custom (vanilla) javascript files. Now, I'm pretty new to Laravel Mix and for the past days I've been trying to get globbing of my custom js files to work. But I can't seem to get it right. Can someone explain or post an example of how I can easily use globbing in my custom js files?
The js folder is as following:
In the basefile I wish to simply write something like require(./folder/*.js)
.
I've found a way to make it work in my webpack.mix.js
file but I'd rather glob the files in my basefile.js
.
Upvotes: 2
Views: 787
Reputation: 20830
You can use laravel-mix-glob
https://www.npmjs.com/package/laravel-mix-glob
Also known under the laravel-mix extension glob
https://laravel-mix.com/extensions/glob
Upvotes: 1