appernetic / hugo-bootstrap-premium

Hugo appernetic bootstrap premium theme
MIT License
83 stars 62 forks source link

customCSS no longer works #47

Open jdoklovic opened 6 years ago

jdoklovic commented 6 years ago

using a customCSS that lives in /static/css no longer works. The issue is that the minifier is looking for the file in the /themes/... folder and not the project static folder:

Error while rendering "home" in "": template: index.html:1:3: executing "index.html" at <partial "head" .>: 

error calling partial: template: partials/head.html:10:5: executing "partials/head.html" at <partial "base/import...>: 

error calling partial: template: partials/base/imports.html:55:44: executing "partials/base/imports.html" at <resources.Get>: 

error calling Get: stat /home/data/<myproject>/themes/hugo-bootstrap-premium/assets/css/mycustom.css: no such file or directory

The offending code is:

{{ range .Site.Params.customCSS }}
    {{ $.Scratch.Add "css" (slice (resources.Get .)) }}
{{ end }}

Since this commit:

https://github.com/appernetic/hugo-bootstrap-premium/commit/c8e60757a009b04b838be406375f81341e5508f7#diff-6494f455c8ec6e853adbc3b0c9bdb7a8

appernetic commented 6 years ago

We want minified CSS, but it would be great also to be able to use custom CSS.

The best solution would be to have assets in the static folder like this /static/css, /static/js, etc. Then change the assetDir by configuring it in the configuration file’s assetDir key to /public/.

I don't know if this is possible but it's worth a try.

Ref: https://gohugo.io/hugo-pipes/introduction/

Asset directory Asset files must be stored in the asset directory. This is /assets by default, but can be configured via the configuration file’s assetDir key.

mgei commented 5 years ago

I could not get this solution to work. Is there an fix for this problem? Maybe I can minify my custom css somehow?

Edit: I found out that I can just put my custom CSS file in /assets/css/style_custom.css, this works fine for me.

appernetic commented 5 years ago

Great!

appernetic commented 5 years ago

I have to find a good solution for this. All PR is now merged at least.