jgazeau / shadocs

Shadocs Theme for Hugo
https://jgazeau.github.io/shadocs/
MIT License
51 stars 20 forks source link

Adding generated resources from resource cache #151

Closed deining closed 1 year ago

deining commented 1 year ago

According to this comment from the hugo creator, committing parts of the resource cache to shadocs repo seems to be reasonable:

If you are theme author, you will most likely want
to put the generated/fingerprinted resources
as part of the theme distribution, so the users
does not need to have PostCSS etc. installed to run your theme.

By adding the resource cache added to the repo, shadocs can be built with the regular version of hugo and without installing postcss:

Without this PR: preview of user guide with regular hugoversion fails:

$ cd userguide && hugo-regular
WARN 2023/03/24 21:51:33 Module "project" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Start building sites … 
hugo v0.111.3-5d4eb5154e1fed125ca8e9b5a0315c4180dab192 linux/amd64 BuildDate=2023-03-12T11:40:50Z VendorInfo=gohugoio
ERROR 2023/03/24 21:51:34 TOCSS: failed to transform "css/404.sass" (text/x-sass). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information
Error: Error building site: TOCSS: failed to transform "css/main.sass" (text/x-sass). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information
Total in 930 ms

With this PR in place: preview of user guide with regular hugoversion succeeds:

$ cd userguide && hugo-regular
WARN 2023/03/24 21:51:58 Module "project" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Start building sites … 
hugo v0.111.3-5d4eb5154e1fed125ca8e9b5a0315c4180dab192 linux/amd64 BuildDate=2023-03-12T11:40:50Z VendorInfo=gohugoio

                   | EN  | FR   
-------------------+-----+------
  Pages            | 102 | 102  
  Paginator pages  |   0 |   0  
  Non-page files   |   0 |   0  
  Static files     |  24 |  24  
  Processed images |   0 |   0  
  Aliases          |   1 |   0  
  Sitemaps         |   2 |   1  
  Cleaned          |   0 |   0  

Total in 1089 ms
jgazeau commented 1 year ago

Hi @deining ,

Sorry for the delay. Indeed seems a good idea for users, but committing these kind of compiled files will make it more complicated to maintain, and also will not make sense for people that try to customize the theme. These file will have to be generated anyway. Furthermore, the only downward is to use the Hugo extended which already contained the sass parser and postcss utility. Users don't need to install additional tools.

Nevertheless the documentation was lacking for some documentation. I've enhanced it and also make it maybe more easy for users to customize the sass part. feel free to have a look

jgazeau commented 1 year ago

I close this issue, if you have any update or comment don't hesitate to comment the other PR 😉