Search code examples
cssruby-on-railsasset-pipelinefont-face

How to properly add '?i#efix' to a font path in rails?


It is recommended to add ?#iefix to the end of .eot font paths to fix yet another IE erratic behaviour :

@font-face {
    font-family: 'MyWebFont';
    src: url('webfont.eot'); /* IE9 Compat Modes */
    src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('webfont.woff') format('woff'), /* Modern Browsers */
         url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
    }

Is it possible to do that using asset_path, but without an ugly + "?#iefix" hack ?


Solution

  • It appears that asset_path already takes this into account. So:

    asset_path 'webfont.eot?#iefix'
    

    does work out-of-the-box ! My bad...