Font assets and plugins


(Charles-Pierre) #1

I have a plugin that transforms [smartass] tags to a custom font, which is served as an otf file.
Serving the otf file used to work perfectly using the code I quote below.

Unfortunately, this method doesn’t work anymore (since when, I don’t know, though). If I copy the files to public/assets, it works, but when I rake assets:precompile the font files are not moved to public/assets, although the .js and .css are correctly included.

What is the correct way to serve non-css (or scss) non-js assets in plugin?

Continuing the discussion from Assets and plugins:


(Theron Boerner) #2

I’m interested to see this plugin. Is the source anywhere on GitHub?


(Charles-Pierre) #3

There you go: GitHub - rux-pizza/discourse-typefaces

As I described in the OP, you have to put the fonts in the assets folder yourself (ie move the folder fonts to public/assets) because of this bug. Or you can call some external font, or just use web-safe fonts. Take a look at the css.

We have the following tags:

  • [smartass], which is rendered by EcritureA-Italique-Orne.otf, a font that is in use by schools in France to teach kids how to write (official font of the public education system!)
  • [corporate], which is palatino
  • [alpha], which transforms the text to all caps and uses impact. Used to assert dominance over fellow board members.

Just look around, modding the plugin to your needs shouldn’t be too difficult.


(Mittineague) #4

Ouch! Aren’t you worried about some members seeing that as YELLING?


(Charles-Pierre) #5

We’re a 7 people board, and we all know each other IRL, so we can allow ourselves much more smartassery than a public board. We’re sassy like that.


(Charles-Pierre) #6

Unashamed bump, I think this is really important for plugin development.


(Theron Boerner) #7

I think /ccing certain people would be better than just bumping. @riking for example.


(Steve Ng) #8

any updates for this? Do we have to manually move it to the public folder?