Ahhh so frustrated! Why isn't CSS and JS working on hugo server?

Do I need npm for css and javascript to work with hugo server?

I have my custom css and js located in my assets folder.

In my partial header, I linked the css like this and same for js
{{ if eq .Page.Section “blog”}}
{{ $style := resources.Get “blog.css” | minify | fingerprint }}

{{ end }}

When I load hugo server, I noticed the css isn’t coming through. The root link is pointed to localhost

I don’t know if this matters but in my config, I have baseURL set to “/”

To answer your question we really need more information. Could you share a link to a repository of your code?

From what you describe you shouldn’t need NPM, Hugo pipes should do the work.

you must add the css into the generated code

<link type=text/css rel=stylesheet href={{ $style .RelPermalink }} integrity={{ $style .Data.Integrity }} />

@ju52 Thanks for your response. The only way I was able to get it to work was by generating the css code within the header itself rather than linking it to a file within assets folder. I can try your code to see if it will link up. Thanks fo the help

{{ if eq .Page.Section "blog"}} {{ with resources.Get "custom.css" | resources.Minify | resources.Fingerprint}} <style>{{ .Content | safeCSS }}</style> {{ end }} {{ end }}