Skip to content
This repository

rake assets:precompile error in Rails (FontAwesome) #292

Closed
akalyaev opened this Issue June 29, 2012 · 12 comments

4 participants

Anton Kalyaev Luiz Eduardo Kowalski Justin Grevich Bradly Feeley
Anton Kalyaev

Hello,

I've just updated your gem and run rake assets:precompile and this is what I've got during deploy:

Invalid CSS after "...e.eot);src:url(": expected expression (e.g. fr, 2n+1), was "/assets/"/asset..."

I think, the case is in vendor/toolkit/fontawesome.less:

@font-face {
  font-family: 'FontAwesome';
  src: asset-url(@fontAwesomeEotPath);
  src: asset-url("@{fontAwesomeEotPath}?#iefix") format('embedded-opentype'),
    asset-url(@fontAwesomeWoffPath) format('woff'),
    asset-url(@fontAwesomeTtfPath) format('truetype'),
    asset-url('@{fontAwesomeSvgPath}#FontAwesome') format('svg');
  ...
}

The result of the code above is:

@font-face {
   font-family: 'FontAwesome';
   src: url(/assets/fontawesome-webfont.eot);
   src: url(/assets/"/assets/fontawesome-webfont.eot"?#iefix) format('embedded-opentype'), url(/assets/fontawesome-      webfont.woff) format('woff'), url(/assets/fontawesome-webfont.ttf) format('truetype'), url(/assets/"/assets/fontawesome-webfont.svg"#FontAwesome) format('svg');
  ...
}

rails: 3.2.3
twitter-bootstrap-rails: 2.1.0

Luiz Eduardo Kowalski

same here, but i think this is related to #290

Luiz Eduardo Kowalski

I've just commented out these lines and worked, but now, I'm without fontawesome

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
//@fontAwesomeEotPath: asset-path('fontawesome-webfont.eot');
//@fontAwesomeWoffPath: asset-path('fontawesome-webfont.woff');
//@fontAwesomeTtfPath: asset-path('fontawesome-webfont.ttf');
//@fontAwesomeSvgzPath: asset-path('fontawesome-webfont.svgz');
//@fontAwesomeSvgPath: asset-path('fontawesome-webfont.svg');

// Font Awesome
//@import "fontawesome";
Justin Grevich

That works, although you can still use the webfont. Remove the svgz version and use absolute paths instead of the asset-path helper. See issue #290 for a more thorough response.

Luiz Eduardo Kowalski

can you provide some example?...i didn't got it :\

Justin Grevich

No problem:

Copy from the new bootstrap_and_overrides.css.less to resolve the issue. Specifically, you need to remove the svgz font path variable and use absolute paths instead of the asset-path helper (see below):

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not 
// have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
Luiz Eduardo Kowalski

thank you :D

Justin Grevich

@luizkowalski, my pleasure. Cheers!

Anton Kalyaev akalyaev closed this July 10, 2012
Anton Kalyaev

Thanks @jgrevich. I think this could be closed now.

Justin Grevich

@akalyaev anytime. I believe we can also close issue #290 as it is a duplicate of this issue.

Bradly Feeley
bradly commented July 20, 2012

@akalyaev Was this actually fixed or do we just have a work-around? If it is still an issue I may have time to work on a patch.

Justin Grevich

@bradly The error was due to people's bootstrap_and_overrides.css.less file declaring variables for the svgz version of the font that no longer exists. The generator has been updated to remove the code, but perhaps we need to improve the error message or provide better documentation for people who are upgrading.

Bradly Feeley
bradly commented July 20, 2012

@jgrevich That makes sense. Thanks for the clarification. I just re-ran the rails g bootstrap:install, re-added my changes, and things are working again. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.