devloco / create-react-wptheme

Create modern, React-enabled WordPress themes with a single command.
MIT License
359 stars 60 forks source link

Can I change the location of the Build Folder? #14

Closed michaelsoriano closed 5 years ago

michaelsoriano commented 5 years ago

Hi @devloco - a few more questions if you don't mind.

When I do npm run wpbuild, can I have the "build" folder outside of the theme directory (as another theme - with a different name)?

So it will have a my-theme-prod instead of my-theme in styles.css?

The reason is, I would like to check 2 versions in my Git repo - so our deployment scripts can simply grab the my-theme-prod and install it.

Thanks in advance.

devloco commented 5 years ago

There's currently no way to do that from create-react-wptheme so you'd have to do it manually.

Or think about creating your own Node script to copy the build folder, then read styles.css from the copy and then modify the name, and finally re-write the file is pretty simple.

I've used shelljs for similar tasks before, check it out:

ShellJS Examples

In fact that example copies a build folder and uses sed to modify the JS files in there. Sounds pretty close to what you're looking for.

michaelsoriano commented 5 years ago

This is awesome. Thanks again!