7
votes

How do I refer to assets within a CSS file?

I am using Play Framework 2.1.3 (Scala).

@font-face
{
    font-family: RockSalt;
    src: url('...something.../assets/fonts/MyFont.ttf');
    format('truetype');
}
1

1 Answers

7
votes

There's nothing magic about this topic in Play , just use relative paths to your font files in your CSS file. ie. if you have css and fonts folders on the same level it will be:

src: url('../fonts/MyFont.ttf');

if you are using default route for assets it can be also path that is relative to app's root:

src: url('/assets/fonts/MyFont.ttf');