I am trying to load some additional fonts in my rails application using:
- Jruby 1.7.3
- Rails 3.2.13
The css (its type is css.scss.erb) document is in app/assets/stylesheets/custom/ folder and looks like follows:
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 300;
src: url('<%= asset_path('/fonts/Lato-Light.woff') %>') format('woff');
}
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: url('<%= asset_path('/fonts/Lato-Regular.woff') %>') format('woff');
}
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: url('<%= asset_path('/fonts/Lato-Bold.woff') %>') format('woff');
}
The fonts file are in application lib/assets/fonts folder. I have added the following line in my application.rb file:
config.assets.paths << Rails.root.join('lib', 'assets', 'fonts')
I am not getting an request error, so I suppose that my fonts are rendered in the web page but they are not applied. That's the path that the asset_path method generates in the result css file:
Has anyone idea what I am doing wrong?