Reputation: 27
Downloaded the following font https://www.fontsquirrel.com/fonts/montserrat and unzipped it. Stuck the otf files in app/assets/fonts.
I have a file called base.scss
in my stylesheets folder where I have this code:
@font-face {
font-family: "test";
src: url("/assets/test.otf");
font-weight: normal;
font-style: normal;
}
.test {
font-size: 40px;
font-family: "test";
}
And in my config/application.rb
file is changed to this:
module Workspace
class Application < Rails::Application
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
# Enable the asset pipeline
config.assets.enabled = true
config.assets.paths << Rails.root.join('/app/assets/fonts')
end
end
However the custom font still is not displaying in text with the .test
class. What am I doing wrong? I'm using cloud 9 IDE by the way if it makes a difference.
Upvotes: 0
Views: 57
Reputation: 141
Here are some tips:
url("/assets/test.otf");
into
asset_url("test.otf");
Upvotes: 1