Path error when compiling scss

Hello,

{{ $style := resources.Get "styles/style.scss" | resources.ToCSS }}
<link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}">

Results into:

<link rel="stylesheet" type="text/css" href="/styles/style.css">
                                             ^ why is this here?

When it should be

<link rel="stylesheet" type="text/css" href="styles/style.css">

I adds a trailing slash before the styles making styles/ into /styles/, which results in the css and every other resource loading through resources.Get not getting the right path.

My config reads:

baseURL = ""

I’m using the above… It should work!

That is not a valid baseURL.

If I add my site, it only works when I upload the entire /public/ folder to my site (which is the expected result) but it doesn’t works when I try to run the site locally because it expects getting the files from my baseURL (my website).

Is there any way to have the right paths to display locally? (that is, to remove that slash?)

The .Permalink value is absolute. You need to add a correct baseURL for it to be correct. Note that when you run hugo server you will, by default, get that baseURL replaced by a local one, typically http://localhost:1313/.

To answer your concrete question: There is no way “to remove that slash”, but that isn’t your real problem.

. Note that when you run hugo server you will, by default, get that baseURL replaced by a local one, typically http://localhost:1313/

Didn’t knew that!

So what’s my real problem?

I don’t know. I just know that the “slash” isn’t it.