Custom assets upload folder?

Is there any default configuration to upload custom assets into the shared folder for web accessible assets like fonts?

It’s a bit weird to allow all the web font formats for uploads into the forum just to add them as assets. I thought there should be some folder in /var/discourse/shared for that.

Search for authorized_extensions in the admin settings.

You have total control over what extensions to allow as you see fit:

2 Likes

sure, I was just thinking there should be a better way to upload a bunch off assets to the forum. Doing it that way is a bit of a hazzle as it renames every file on upload and it sounds a bit weird to activate all the file formats for upload that I wouldn’t allow my users to upload usually.

1 Like

The only setting that would affect all users is the second one. Allowing svg uploads for staff or in themes does not mean that all users will be able to upload svg files.

I’m still unsure what your use case is. Can you share a bit more on what you’re trying to do?

Well maybe I’m just getting it wrong? I’d like to upload a bunch (24) font files to be used in my theme. I would prefer to just upload them via sftp to a folder instead of uploading them in the forums. The way assets are uploaded to the assets topic in staff forum renames them and I need to wildly encrypt the css file for fonts instead of having clear naming. Also I need to add the fonts to “authorized extensions” that way.

I’m not sure how the ‘theme authorized extensions’ work - but maybe that’s the way it should go - where are these theme uploads?

EDIT: just ignore me - I really should have opened my eyes first :-/

Ok so this topic can be removed then?

well yeah I guess this is the way to do it then - it’s still a bit more awkward than I was hoping for but it looks like there’s no easy way to just put static assets in a folder.

When you upload theme assets you can assign variables to them.

You can then use the variables to call them like so (in the case of fonts)

@font-face {
  font-family: 'font';
  src: url(#{$fontWoff2}) format('woff2');
}

.foo {
  font-family: 'font';
}
4 Likes

Also, if you develop a theme using a git repo, you can put all your assets in an /assets folder. But you still have to assign variables for them in about.json

More details here:

4 Likes

Yes, put them in a folder in an external webserver (or shared webfonts from a proper CDN). Problem solved.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.