I’m currently in a project where we’re looking to dynamically build styles using Sage 9 and webpack. Here’s a brief run down of requirements:
- Build styles as normal locally using
yarn run build- This works
- On the app server build a variables.scss file dynamically based on options stored in the DB - This works
- Build a new stylesheet on the app server with yarn / webpack. Then upload that to
- Load that stylesheet instead of the one found at theme level - This works
Everything is working as expected until I want to pass the new path to the webpack build process dynamically.
The ideal build command would be:
webpack --progress -p --config resources/assets/build/webpack.config.js --env.custompath="/wp-content/uploads/SITE-ID/dist/"
Where according to webpack documentation
env.custompath should equal
env.custompath is always undefined. But in this discussion it appears to be possible. Can anyone shine a light on what I’m missing here?
Just to clarify I’m looking to change the dist output path dynamically only - all other aspects of the build process I’m cool with
Thanks a lot in advance