Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customCSS no longer works #47

Open
jdoklovic opened this issue Aug 29, 2018 · 4 comments
Open

customCSS no longer works #47

jdoklovic opened this issue Aug 29, 2018 · 4 comments

Comments

@jdoklovic
Copy link

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:

c8e6075#diff-6494f455c8ec6e853adbc3b0c9bdb7a8

@appernetic
Copy link
Collaborator

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
Copy link

mgei commented Oct 23, 2018

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
Copy link
Collaborator

Great!

@appernetic
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants