gohugoio / hugoThemes

A curated directory of Hugo themes
https://themes.gohugo.io/
MIT License
1.77k stars 245 forks source link

Ported the Drupal zen base theme to Hugo #228

Closed frjo closed 7 years ago

frjo commented 7 years ago

A port of the Drupal zen base theme with libsass and gulp support.

https://github.com/frjo/hugo-theme-zen

digitalcraftsman commented 7 years ago

Hello @frjo,

thank you very much for sharing this theme with the Hugo community. Your theme looks fine but the build script for the theme as wel as a manual check of the them failed to build.

When doing

hugo new site foo
cd foo/themes
git clone https://github.com/frjo/hugo-theme-zen
cd ..
hugo server -t=hugo-theme-zen

I get the following error message:

ERROR 2017/03/20 20:29:22 Error while rendering "page ": template: /tmp/foo/themes/hugo-theme-zen/layouts/_default/baseof.html:5:48: executing "/tmp/foo/themes/hugo-theme-zen/layouts/_default/baseof.html" at <readFile "/themes/ze...>: error calling readFile: stat /tmp/foo/themes/zen/static/css/styles.css: no such file or directory

The usage of the readFile template func causes this error because the linked CSS file can't be found. It's seems you want to add the SHA1-hash of the stylesheet's content to change the URL for caching purposes. If so I would suggest to hash just the filename with a random value, e.g. the built time as a UNIX timestamp. This increases the build performance too.

Regards, Digitalcraftsman

frjo commented 7 years ago

My mistake, used the theme path when I should be using /public path. Fixed now.

Thanks of the suggestion regarding generating the cache busting hash.

I prefer to use the hash of the file to only generate a new hash if the file actually have changed. Hugo is so blasting fast so I think it is worth the small extra cost. Made them optional now with default off.

bep commented 7 years ago

@frjo If you haven't already, you should consider loading those via partialCached, which gets you best of both worlds.

frjo commented 7 years ago

@bep Thanks, implemented partialCached now where appropriate. Didn't change the build time mush for my small site, but it builds in 12 ms so I'm not exactly complaining.

Hugo builds my site faster than a browser can load one of the pages!

digitalcraftsman commented 7 years ago

Great, I've merged your theme in d34b780bcda69ba6885f53a3e1f8b9ef46efd909.