Skip to content
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

gatsby build deletes all html files #2559

Closed
singuerinc opened this issue Oct 20, 2017 · 7 comments
Closed

gatsby build deletes all html files #2559

singuerinc opened this issue Oct 20, 2017 · 7 comments

Comments

@singuerinc
Copy link
Contributor

I have a bunch of examples in my blog, small index.html files with a bit of js.
I put them in a folder inside the static folder.

If I run gatsby develop everything works well, but I soon as I run gatsby build every html file is deleted because https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/index.js#L64

And that's seems to be the correct behavior, so my question is: How you handle this situation?

I tried to use the onPostBuild function and that works ok with gatsby build, but not with gatsby develop, so I'm not entirely sure how to solve that.

Any idea?

@KyleAMathews
Copy link
Contributor

Oh, hmmm does this happen? The solution would be then to copy stuff from the static folder after we delete the HTML files in public. Could you create a PR doing this?

@singuerinc
Copy link
Contributor Author

What about excluding public/static/**/*.html from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/index.js#L64 ?

@KyleAMathews
Copy link
Contributor

👍 that'd work too

@singuerinc
Copy link
Contributor Author

I don't have time right now but I will create a PR asap. Thanks!

@singuerinc
Copy link
Contributor Author

Done: #2569

@singuerinc
Copy link
Contributor Author

Unfortunately the fix didn't work as expected, it is still removing the files.

Looking into the readme of "del" I saw:
https://www.npmjs.com/package/del#beware

So, that was the cause why it didn't work before.

I created a new PR that should fix it properly:
#2600

Thanks!

@singuerinc
Copy link
Contributor Author

I works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants