okkur / syna

Highly customizable open source theme for Hugo based static websites
https://syna.okkur.org/demo/
Apache License 2.0
251 stars 133 forks source link

Remove /exampleSite/resources/_gen from the repository #867

Open fjtc opened 2 years ago

fjtc commented 2 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

FEATURE REQUEST

What happened:

I think it would be a good idea to remove the directory /exampleSite/resources/_gen from the repository and add it to .gitignore as it is generated again whenever needed by Hugo. Furthermore, some posts, such as https://discourse.gohugo.io/t/the-best-gitignore-for-hugo/20283 suggest that this directory can be safely ignored for sites.

What you expected to happen:

The directory will no longer be in the repository, messing with its history. Since the files inside this directory are generated by Hugo from the source of the site, there is no point to keep them in the repository. Furthermore, since they are usually stored as binary files or single line text fields, any changes on those files means a complete replacement of their contents regardless of the size of the changes.

How to reproduce it (as minimally and precisely as possible):

Just change something in the theme's CSS and run the site. Some files inside /exampleSite/resources/_gen will eventually change. If you remove the directory before execute Hugo, it will be generated automatically by it based on the site's source thus there is no need to add it to the repository.

Anything else we need to know?:

It is a minor repository issue that can reduce the size of the repository in the long term. If you think it is a good idea, let me know and I'll send a pull request with this change.

Environment:

stp-ip commented 2 years ago

The reasoning behind having the _gen directory included and checked in is for the non extended Hugo version to function. If I remember correctly only the extended Hugo version does generate the assets. The "normal"/lightweight one only uses them.

Maybe I missed this change and both the lightweight and the extended hugo version works without any pregenerated assets now. Could you check please.

fjtc commented 2 years ago

I'll test it here. In fact I'm using the extended version of Hugo 0.80. I was told to always stick with the extended version as it is the best way to run anything as the normal and lightweight do not run with some themes. I'll test it here and see what happens. As soon as I get the results I'll update this issue.

stp-ip commented 2 years ago

Yeah I'd say running with the extended version is best especially while working on themes as well, but not every platform and therefore not every user does have it and we wanted to stay compatible with the "no-code" users as well. Thanks for taking a closer look.