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

There should be a way to ignore the build process on certain files in the pages directory other than simply copying from the pages directory to the public directory. #450

Closed
chiedo opened this issue Sep 17, 2016 · 4 comments

Comments

@chiedo
Copy link

chiedo commented Sep 17, 2016

I'd like to propose something like a .leave-these-files-alone file where we could specify files that shouldn't be put through the Gatsby build process other than copying

For example, I have a google webmaster tools verification file called blahblah.html and I want that to simply be copied from my pages directory into my public directory in the build process instead of it being converted to a folder named blahblah with an index.html file in it and I want to add a runprettify.js file to my pages directory and have it be simply copied upon build instead of Gatsby trying to process the file resulting in freakouts from window not being available.

I hope what I'm asking is making sense. I know with a lot of these things, doing things the React way solves the issue. But it would be nice to be able to add files or directories to the .leave-these-files-alone file and have those files/directories just copied instead of being processed.

Any thoughts from anyone are welcome. I plat to start implementing within the next few weeks.

@KyleAMathews
Copy link
Contributor

Yeah — this is a decently common request. I think the best thing now is to just implement the postBuild hook and copy files over yourself — https://github.com/britt/britt.github.com/blob/0cdce436ced01eef9b7a6688a4c874afa63bc69a/gatsby-node.js#L99

In 1.0, with its plugin system, my plan is to add an officially supported plugin which will make this very simple e.g.

new DirectoryCopyPlugin({ // or whatever the name is we choose
  directory: './directory-to-copy',
})

I'm also thinking there'll be an official "core theme" that is part of the official themes and others can build themes on top of (themes will be composable) and it could have this plugin installed by default.

How's that sound?

Also, what do you think a directory for these sort of files should be called?

@chiedo
Copy link
Author

chiedo commented Sep 17, 2016

That sounds great @KyleAMathews

I ended up adding a
&& cp pages/blah public/blah to the end of my build command in my package.json haha.

In regards to the name of such a directory, I think the name static would make sense. I know that everything is static after the build process but the static directory would be for files that don't change in any way and just get moved.

@chiedo
Copy link
Author

chiedo commented Sep 19, 2016

Thinking about this further @KyleAMathews , we may be complicating things. I'm thinking there should be a directory named 'static' in the root of the project that is served from /static in local development and then upon build gets copied to public/static.

That way any files in that directory would remain untouched and we wouldn't have to worry about side effects, etc.

@chiedo
Copy link
Author

chiedo commented Jun 28, 2017

Closed as this functionality is added to gatsby 1.0

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