jaspervdj / hakyll

A static website compiler library in Haskell
jaspervdj.be/hakyll
Other
2.68k stars 409 forks source link

Deployment of dotfiles by default? #954

Open damiencourousse opened 1 year ago

damiencourousse commented 1 year ago

I had an issue with the deployment of files and directories which names would start with a dot. After a lot of time I stumbled on #841 https://github.com/jaspervdj/hakyll/issues/841#issuecomment-826128233 and could solve the issue.

By default, I think dotfiles should be deployed. Is there any reason not to? To avoid the deployment of a '.git' directory in particular cases?

Minoru commented 1 year ago

Judging by the commit that introduced it (f04efbad3ed6f5cbc215f8aa72b1bd0203712768) and a later commit that added support for Emacs (ca17e43628e1196701c65993480dffa650cb0916), the goal of ignoreFile is to exclude temporary files created by text editors. It doesn't explain why dotfiles were included in there.

Still, I think it's a good idea to ignore them, because I can think of only a single case where I'd want such a file to be deployed: .htaccess. Is that what you tried to do?

We definitely need to make this behaviour more visible though, because people bump into it from time to time (#560, #841). Can you recall what docs you looked at while trying to figure it out? Currently this is only documented in Hakyll.Core.Configuration, which is clearly not enough. Perhaps we should also teach Hakyll to count the number of ignored files and display it at the end of the build, and provide the list of those files in build --verbose.

damiencourousse commented 1 year ago

Still, I think it's a good idea to ignore them, because I can think of only a single case where I'd want such a file to be deployed: .htaccess. Is that what you tried to do?

I had a use case where I needed to (process and) deploy some files, but not include them in sitemap.xml. Using dotfiles for this seemed to be a simple naming convention.

We definitely need to make this behaviour more visible though, because people bump into it from time to time (#560, #841). Can you recall what docs you looked at while trying to figure it out? Currently this is only documented in Hakyll.Core.Configuration, which is clearly not enough. Perhaps we should also teach Hakyll to count the number of ignored files and display it at the end of the build, and provide the list of those files in build --verbose.

I agree. The easily accessible documentation lets the user think that all the files are processed (e.g. in default compilers).

Explicitly listing those files in a verbose build can also help.

Minoru commented 1 year ago

I guess Hakyll.Core.Rules.match would be a better place than compilers, because that's where filenames are handled. Currently this function is not documented at all :(

rpearce commented 1 year ago

I can think of only a single case where I'd want such a file to be deployed

There is also the popular .well-known/ folder that Brave and Keybase use, for example (there are plenty of others).