I knew this was probably going to be an issue, but couldn’t find any resources for circumventing it. The fonts are registered as assets, then referenced in the stylesheet as relative URLs. This is a problem for our website, and will be for other Discourse websites accessed in a directory (i.e., https://critcola.com/community/).
Of course, I could easily fix this for us, but then the plugin would be unusable by other Overwatch communities. Any thoughts on how to approach this?
As I think it is relative to the Stylesheet path, and thus the font folder will be up one directory which will also be true for non-subfolder installs.
I didn’t even think of that. I think we’re getting closer. Since I knew the first approach I took wouldn’t work, I didn’t even bother to check if the fonts were actually there, but now that I updated the font paths using your relative URL scheme, I’m seeing that the fonts don’t appear to be there.
There are fonts for Font Awesome in Discourse’s assets directory, but no actual “fonts” directory, as far as I can tell. A search for fonts in Discourse’s filesystem found the fonts in the plugin’s directory, but not somewhere where it would be Internet-accessible, I think. Any idea why? Where should fonts registered as assets in the plugin be stored?
So the best solution I can give you, is one of the following
Upload the fonts to a CDN, reference the CDN in the CSS (applies for all scenarios).
Upload the fonts to the root of your main site and in the CSS use /fonts/overwatch-heroes…
Inform people in the README to do the same so it works for them too (doesn’t really apply for those running on a sub-domain though)
Instruct users to change the Site Setting authorized extensions to be able to upload the fonts, then copy and paste CSS into the Admin > Customize area to reference those uploaded URLs for the @font-face (and in your plugin CSS, do not have that @font-face portion in it)
This is probably the most convoluted way
So without getting the fonts to a location where they can be served, you won’t be able to reference them
Strange. Last night, I ended up hosting the fonts with GitHub and changing the font URLs in the stylesheet, so I’ll probably stick with that approach. I wonder why fonts are restricted in plugins?