Is there a standard way to scale Laravel Mix to support a build process of 50+ different frontend themes?
I'm simply running npm run dev
and npm run watch
currently with four different themes in my webpack.mix.js file, and that goes through and builds/watches all of those themes at once, but I fear performance is going to break down when we go to scale. Ideally I would like to be able to only build/watch themes one at a time, e.g. npm run dev --theme:some-site
or npm run watch --theme:another-site
Here's what my webpack.mix.js is eventually going to look like at this rate if I don't change anything:
const mix = require('laravel-mix');
// Parent Theme
mix.js('resources/[parent-theme-folder]/assets/js/app.js', 'public/[parent-theme-folder]/js/')
.sass('resources/[parent-theme-folder]/assets/scss/app.scss', 'public/[parent-theme-folder]/css/')
;
// Client 1
mix.js('resources/[child-theme-1-folder]/assets/js/app.js', 'public/[child-theme-1-folder]/js/')
.sass('resources/[child-theme-1-folder]/assets/scss/app.scss', 'public/[child-theme-1-folder]/css/')
;
// Client 2
mix.js('resources/[child-theme-2-folder]/assets/js/app.js', 'public/[child-theme-2-folder]/js/')
.sass('resources/[child-theme-2-folder]/assets/scss/app.scss', 'public/[child-theme-2-folder]/css/')
;
...etc...
// Client 47
mix.js('resources/[child-theme-47-folder]/assets/js/app.js', 'public/[child-theme-47-folder]/js/')
.sass('resources/[child-theme-47-folder]/assets/scss/app.scss', 'public/[child-theme-47-folder]/css/')
;
Any suggestions? Thanks!
--
Some more info on our setup, if it helps...
We're using a parent/child theme package - igaster/laravel-theme - to manage multiple frontends in one Laravel project. Essentially, we have 4 types of website products, and 20-30 clients that all have their own instance of up to 4 of those products. They each have their own child theme that extends the parent theme for that product to add any custom layouts, styles, views, etc. We felt one Laravel project was going to be easier to manage than setting up 20-30 different Laravel projects for each client, especially when it came to managing maintenance and updates.