Closed gene1wood closed 9 months ago
@april It's gotta be related to the SASS processing. I can control where the files end up in the built directory just fine, but I've been unable to get the SASS loaders to consume the fonts scss file and render url
CSS statements with a path present.
Sorry, I still haven't had any time to even look at this. Is it consuming the other CSS files fine, or is only the fonts one that isn't working?
@april The only uses of url()
in the scss
files are the fonts. I did try as a test just taking the content of the _fonts.scss
file and adding it directly into index.scss
in case the @import
of _fonts.scss
was the issue, but that didn't fix it.
I suspect, if there were any uses of url()
elsewhere in the scss
files, they too would assume that the referenced asset was in the root.
And in the current PR I have there, the fonts work, because I just said to put the font files in the root where the rendered CSS files reference them. So I could just merge this and it would work, it's just that the fonts would be in the root path instead of the /fonts/
directory (which would be a bit messy but not the end of the world)
Does url()
work if you set it to a static path rather than a relative one?
@janbrasna Thanks so much! I dug a bit further based on your guidance but wasn't able to figure it out, but your suggestion of just using hosted fonts sounds great to me, so I'm going to do that. Thanks for your help!
Don't forget to add the font-src
into the CSP at the top of the page, in the meta tags.
I forgot CSP blocks loading of fonts from the CDN. I'll fix that.
Actually you need style-src
to @import
from https://code.cdn.mozilla.net/fonts/zilla-slab.css
With this change, the static assets like fonts are hosted at the root of the path instead of within their subdirectories like
/fonts
I've been unable to figure out how to get this to work correctly where the SASS
url
references to fonts would point to/fonts
. To work around this, I've commented out theoutputPath
in theasset/resource
copying over of the fonts.@april Can you tell at all how to get the URL paths to work correctly?
To see the issue, checkout this PR,
npm install
andnpm run watch
and you'll see that the resultingurl
paths to the font files are the root of the site instead of/fonts