sintaxi / harp

Static Web Server/Generator/Bundler
http://harpjs.com
5k stars 346 forks source link

Copy file with leading underscore #621

Closed Nadeeshyama closed 5 years ago

Nadeeshyama commented 6 years ago

I'm using Harp on Netlify and want to add some redirects. However, Harp doesn't process files starting with an underscore character and Netlify's redirect file name is "_redirects". I know npm scripts can be used to combine a copy command along with harp compile but wondering whether there's a another way to do it within Harp.

Thanks.

mjsweet commented 6 years ago

I too second this - I want to include a _headers file in the root of public for setting up basic auth... as well as redirects. @Nadeeshyama did you have any luck with this?

misterhtmlcss commented 5 years ago

@mjsweet @Nadeeshyama I can't replicate the issue. I'm guessing for @Nadeeshyama it's a Netlify issue and for you @mjsweet I'm not sure how you did it to recreate his issue, but I just used _headers.jade and it imported just fine. Perhaps I misunderstand your situation. If you find you are still having the issue, please follow up here or in a new Issue and we can try work it out together.

Nadeeshyama commented 5 years ago

I too second this - I want to include a _headers file in the root of public for setting up basic auth... as well as redirects. @Nadeeshyama did you have any luck with this?

I ended up using an npm script entry. I run this after harp compile as part of my build. "postdep": "shx cp -uR config/* www/"

mjsweet commented 5 years ago

Hi @Nadeeshyama, this is a great solution. @misterhtmlcss basically any file with and underscore prefix won't go into the compiled version of the site, so the _headers file is basically ignored by harp compile.

mjsweet commented 5 years ago

I too second this - I want to include a _headers file in the root of public for setting up basic auth... as well as redirects. @Nadeeshyama did you have any luck with this?

I ended up using an npm script entry. I run this after harp compile as part of my build. "postdep": "shx cp -uR config/* www/"

I will use it @Nadeeshyama - thanks for posting the line.

Nadeeshyama commented 5 years ago

@mjsweet @Nadeeshyama I can't replicate the issue. I'm guessing for @Nadeeshyama it's a Netlify issue and for you @mjsweet I'm not sure how you did it to recreate his issue, but I just used _headers.jade and it imported just fine. Perhaps I misunderstand your situation. If you find you are still having the issue, please follow up here or in a new Issue and we can try work it out together.

In my case its a plain text file (for Netlify redirects) that need to be copied to www folder without being processed. I'm only familiar with Netlify, but I'm guessing other hosting providers could have config files starting with an underscore too.

Nadeeshyama commented 5 years ago

I too second this - I want to include a _headers file in the root of public for setting up basic auth... as well as redirects. @Nadeeshyama did you have any luck with this?

I ended up using an npm script entry. I run this after harp compile as part of my build. "postdep": "shx cp -uR config/* www/"

I will use it @Nadeeshyama - thanks for posting the line.

👍

misterhtmlcss commented 5 years ago

@Nadeeshyama @mjsweet I was reading through Netlify and if that's the site you guys are both working with then I see looking at the docs (relevant link) that you can use a netlify.toml instead of a _redirects file. I think that's the best solution in the context of Netlify.

If there are other tools/platforms you are working with let me know and we can look together to see if they have alternatives as well.