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

Closed
melekes opened this Issue Jun 29, 2012 · 12 comments

Comments

Projects
None yet
4 participants
@melekes

melekes commented Jun 29, 2012

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

@luizkowalski

This comment has been minimized.

Show comment
Hide comment
@luizkowalski

luizkowalski Jun 29, 2012

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

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

@luizkowalski

This comment has been minimized.

Show comment
Hide comment
@luizkowalski

luizkowalski Jun 30, 2012

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";

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";
@jgrevich

This comment has been minimized.

Show comment
Hide comment
@jgrevich

jgrevich Jul 10, 2012

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.

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.

@luizkowalski

This comment has been minimized.

Show comment
Hide comment
@luizkowalski

luizkowalski Jul 10, 2012

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

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

@jgrevich

This comment has been minimized.

Show comment
Hide comment
@jgrevich

jgrevich Jul 10, 2012

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';

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';
@luizkowalski

This comment has been minimized.

Show comment
Hide comment
@luizkowalski

luizkowalski Jul 11, 2012

thank you :D

thank you :D

@jgrevich

This comment has been minimized.

Show comment
Hide comment
@jgrevich

jgrevich Jul 11, 2012

@luizkowalski, my pleasure. Cheers!

@luizkowalski, my pleasure. Cheers!

@melekes

This comment has been minimized.

Show comment
Hide comment
@melekes

melekes Jul 11, 2012

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

melekes commented Jul 11, 2012

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

@melekes melekes closed this Jul 11, 2012

@jgrevich

This comment has been minimized.

Show comment
Hide comment
@jgrevich

jgrevich Jul 11, 2012

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

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

@bradly

This comment has been minimized.

Show comment
Hide comment
@bradly

bradly Jul 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.

bradly commented Jul 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.

@jgrevich

This comment has been minimized.

Show comment
Hide comment
@jgrevich

jgrevich Jul 20, 2012

@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 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

This comment has been minimized.

Show comment
Hide comment
@bradly

bradly Jul 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!

bradly commented Jul 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