Skip to content

hugodoes not generate css like hugo server #124

@k-caps

Description

@k-caps

When running hugo server the site renders properly, but when doing just hugo, the website does not render well.
This is NOT the same problem as #108.
For me, some things are working (the top menu bar is in place and looks ok, and the profile image is in the right place and looks correct). When i press f12 on my proper hugo server version, there is a stylesheet called styles.css with 10k rules. However when building the public dir and running the site with a webserver (python3 -m http.server 8080 for localhost, and on Cloudflare Pages), there is only a stylesheet called styles.min.xxxx.css, which has just 300 rules. So for example, there is no background accent color.

I tried using all variations of npm,hugo --gc and others, with and without css purging, but always reach the same result - hugo server works, building does not.
For now, I downloaded styles.css from the local version that works, and put it in my repo's static. When I build, I run a sed command which replaces all references to the file with my static stylesheet, and remove integrity checks. I can also dynamically replace the stylesheet and rename mine according to whatever styles.minwas generated.
For now, this is working, but it feels like a very "duct tape" solution instead of just fixing the root cause.

(Playing with baseURL makes no difference - the css works when using the file, it just is very incomplete.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions