2

I read a lot of posts about using custom fonts in Rails 4 , different approach and I could not get a way to make it fine in both development AND production mode ...

In development mode , I added my fonts in a specific folder 'et-line',

app/assets/fonts/
   |_ et-line
       |_ et-line.eot
       |_ et-line.svg
       |_ et-line.ttf
       |_ et-line.woff

in my 'elegant.css' file, I added the following entries ...

        @font-face {
        font-family: 'et-line';
        src: url('/assets/et-line/et-line.eot');
        src: url('/assets/et-line/et-line.eot?#iefix') format('embedded-opentype'), 
        url('/assets/et-line/et-line.woff') format('woff'), 
        url('/assets/et-line/et-line.ttf') format('truetype'), 
        url('/assets/et-line/et-line.svg#et-line') format('svg');
        font-weight: normal;
        font-style: normal;
        }

this runs fine in development, ... I get the font icons displayed.. but going into production, the resources are NOT loaded

the compiled application.css contains :

@font-face {
font-family: 'et-line';
src: url("/assets/et-line/et-line.eot");
src: url("/assets/et-line/et-line.eot?#iefix") format("embedded-opentype"), url("/assets/et-line/et-line.woff") format("woff"), url("/assets/et-line/et-line.ttf") format("truetype"), url("/assets/et-line/et-line.svg#et-line") format("svg");
font-weight: normal;
font-style: normal

}

obviously the /fonts/ folder is missing... however if I add it in my elegant.css file... then it doesn't work in development mode ....

what's the correct writing ? /assets , /assets/fonts/ ? none but another way ??

thanks for enlightment ...

  • If you haven't solved this, check this other soSO post. Find the Rails 4 part of the answer -> http://stackoverflow.com/questions/10905905/using-fonts-with-rails-asset-pipeline – emcanes Feb 23 '15 at 15:36
  • I wrote a generic way to diagnose and solve this problem at http://stackoverflow.com/a/40898227/1197775. – sites Nov 30 '16 at 21:11

0 Answers0