Reputation: 3857
I'm using Laravel & Webpack to compile CSS for 4 different themes. But each time I only want to compile the one theme.
I am storing in my Database a template_home variable. I don't mind putting this var in my .env file either..
Ideally I'd like to then use that variable to compile one of the 4 mixes.
Is this possible?
Thanks
Upvotes: 0
Views: 132
Reputation: 42
Yes, this should be possible with the dotenv
npm package.
First install the package with npm: npm install dotenv --save-dev
.
Then add the template key to the .env
-file:
...
THEME_KEY=test_01
...
webpack.mix.js
-file:const mix = require('laravel-mix');
const dotenv = require('dotenv').config();
mix.sass('resources/assets/sass/' + process.env.THEME_KEY + '.scss', 'css');
Hope this helps!
Upvotes: 1