Skip to content

Builds put the theme files in a sub directory of the theme #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikelinden1 opened this issue Oct 16, 2019 · 5 comments
Closed

Builds put the theme files in a sub directory of the theme #31

mikelinden1 opened this issue Oct 16, 2019 · 5 comments
Assignees
Labels

Comments

@mikelinden1
Copy link

Hi there. When I run the build command the theme files are created in a subdirectory of my theme (ex: my-theme/my-theme/style.css). I created a new theme to be sure the issue wasn't something related to my theme and saw the same behavior. Any ideas?

@devloco
Copy link
Owner

devloco commented Oct 16, 2019

If I understand you correctly, that is by design. Check out the deploying instructions here:

Deploying Your Theme

I have struggled with this a bit... how best to communicate to the user about differences between dev and prod. I'm coming up with more ideas... some of the other issues I've filed for myself in here are in that regards.

Let me know if I misunderstood you. Also, any ideas around developing vs deploying are welcome.

Thanks!

@devloco devloco self-assigned this Oct 16, 2019
@devloco devloco added the question Further information is requested label Oct 16, 2019
@mikelinden1
Copy link
Author

I see. Yes, that's what the documentation says. For our use-case it would make more sense if the files were in the root of the theme so when we deploy via git it works as is. This way I need to create a wrapper around yarn build that moves the generated files.

@devloco
Copy link
Owner

devloco commented Oct 16, 2019

Yah, I just ran into so many people that didn't understand the folder layout for this project, and they would deploy their theme to prod, but ended up with the react-src folder on their prod server. Which... even worse, contains the node_modules folder. Ugh!

Like I mentioned, I am going to revisit the whole build process. Lots more hand-holding. But I think I can also add a setting or two to the user.prod.json file. Maybe an onSuccessMoveToFolder type of thing.

Someone else a while back had a similar work flow to yours. I recommended shelljs. Here's the issue link: #14 if you're interested.

I'm going to leave this ticket open for now, and look at it when I do the "build revisit".

Thanks!

@devloco devloco added enhancement New feature or request workaround available and removed question Further information is requested labels Oct 16, 2019
@mikelinden1
Copy link
Author

Adding a configuration option for this would be great! Thank you for making this project

@devloco
Copy link
Owner

devloco commented Nov 24, 2019

This is done in the latest release: 3.2.0-wp.2.

Inside the user.prod.json file you can add a new property named "finalBuildPath" and when you run npm run build inside the react-src folder, your compiled files should end up where you want them. I tested with a value of ".." so that they would end up in the theme's root folder, like you wanted.

Here's the contents of the user.prod.json file I tested with:

{
"finalBuildPath": "..",
"homepage": "/wordpress/wp-content/themes/foobar"
}

Let me know if it doesn't work for you.

Thanks!

@devloco devloco closed this as completed Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants