Closed alexhaydock closed 9 months ago
Hi @alexhaydock,
This is an unexpected bug. I have to check the logic once again. I will let you know if I'm able to unearth anything.
Putting in an empty file is a hack though😅, and it goes against the "minimal" mindset
Hi @alexhaydock,
Sorry for the glorious delay. I didn't get much time to do anything else.
However, I can see that you are using Hugo version v0.111.3 which was released in March of 2023.
Current Hugo Version is v0.122.0. Please use the latest version and let me know if you are facing same problem.
I am closing this issue for now. Feel free to re-open if issue persists.
Hey @1bl4z3r,
thanks for the nice theme. Really like it.
I'm new to the theme and also faced the same issue, with the Hugo Version v0.122.0.
Creating the scss
Directory under assets
fixes it however.
Would be great to have that mentioned somewhere in the README.
Have a great day!
Hi @JH220,
Thank you for responding. However, this is a classic "It works on my machine" problem. If you check Staging Branch, you will find that userstyles.scss isn't present, and theme compiles.
I suspect that there might have been some changes on your end. If you are able, you could share your project with me, so that I may re-create the issue (because whatever I'm doing I can't recreate the issue)
Please let me know if you are open for that
Hi again.
I totally misread your reply.
I shall check if missing assets/scss
directory causes this issue. Please give me a couple of days.
Hey @1bl4z3r, thanks for your fast response. This happens for me on a brand new project.
So after I run
hugo new site example
, cd example/
,
git init
, git submodule add -b main https://github.com/1bl4z3r/hermit-V2 themes/hermit-v2
cp themes/hermit-v2/hugo.toml.example hugo.toml
and change the baseURL
as well as uncomment the theme = "hermit-v2
, I can't run hugo server
without the error for the missing directory.
After creating an empty directory assets/scss
, everything works fine.
Thanks @JH220 for letting me know the steps. I will follow the same, and find a good way to prevent the error
@JH220
Sorry for not properly tagging you in replies. Hope you didn't take offense to that.
No problem.
What is also a bit annoying is that if you have not customized any scss scripts, the folder stays empty and if you want to publish the website for example to GitHub Pages, it throws an error because the empty folder is not uploaded to git, so an empty file must be created first in the folder as a workaround.
But overall, this theme is really great and has been kept minimalistic, but nevertheless very powerful and with many functions. Many thanks for your great work.
What is also a bit annoying is that if you have not customized any scss scripts, the folder stays empty and if you want to publish the website for example to GitHub Pages, it throws an error because the empty folder is not uploaded to git, so an empty file must be created first in the folder as a workaround.
For what it's worth, my lazy 'solution' to this is to create the empty directory and then touch a .gitkeep
file inside it, which lets you track the otherwise empty dir with Git and push it to a repo.
People @alexhaydock @JH220
I am happy to announce that after lots of procrastination, I was able to dial down the issue.
If you have current release of hermit-V2, the change is required as follows in /themes/hermit-v2/assets/scss/style.scss
:
{{ if (fileExists "assets/scss/userstyles.scss") }}
@import "userstyles.scss";
{{ end }}
Reason : readDir was expecting assets/scss
as a directory. You can think this as a pre-requisite; upon which it will check if userstyles.scss
exists or not. That's why when compiling readDir is throwing an error.
This change removed readDir
, and uses fileExists
which will return true or false if file exists. If file exists, it is imported into scss. I have tested with
I will release tomorrow to address this bug. If you need this to work immediately, you guys can try above.
P.S. I truly hate hacky solutions. Not to curb any genuine creativity or anything, but people finding Original hermit theme buggy and resorting to hacky ways to work with this led to creation to this V2 in the first place.
Pushed change to main branch. Hopefully the issue should be resolved, as the sub-directory dependency should not be there If not, we can check further.
Closing this issue
Hi! Thanks for the great theme :smile:
The latest v1.0.12 build causes an error to be thrown when the theme is cloned as a submodule of a repository which does not have an
assets/scss
directory due to the addition of this code:https://github.com/1bl4z3r/hermit-V2/blob/93f7434e64b8ffec8fc3c127eef2593f6037cda3/assets/scss/style.scss#L9-L11
I'm guessing this is down to the fact that although an
if
is being used, thereadDir
tries to read the contents ofassets/scss
before theif
is invoked. Maybe there's anotherif
statement that could be nested in here to avoid failing out if the directory doesn't exist.It's not a showstopping issue, because creating an empty
assets/scss
directory is enough to make this work as it did before, but it might be one to call out in the README for new users that this directory needs to exist. I only noticed this so easily because the theme previously worked and I was able to see quite quickly from the recent commits what the cause was. I think a user who is newer to the theme might just be puzzled by this one.