Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font paths aren't remapped when building with lessc -ru #13429

Closed
ali1234 opened this issue Apr 25, 2014 · 7 comments
Closed

Font paths aren't remapped when building with lessc -ru #13429

ali1234 opened this issue Apr 25, 2014 · 7 comments
Milestone

Comments

@ali1234
Copy link

ali1234 commented Apr 25, 2014

To reproduce:

git clone git://github.com/twbs/bootstrap
echo '@import "bootstrap/less/bootstrap.less";' > my.less
lessc -ru my.less | grep fonts

Expected output:

  src: url('bootstrap/fonts/glyphicons-halflings-regular.eot');
  src: url('bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), url('bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');

Actual output:

  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');

This happens because the src urls are escaped in glyphicons.less:

src: ~"url('@{icon-font-path}@{icon-font-name}.eot')";

Removing the ~"" escaping causes the correct relative URLs to be generated:

src: url('@{icon-font-path}@{icon-font-name}.eot');

This might be the cause of #13336

@ali1234
Copy link
Author

ali1234 commented Apr 25, 2014

This change was introduced in #10941 which appears to do the exact opposite of what it claims to do.

@ali1234
Copy link
Author

ali1234 commented Apr 25, 2014

For the next person to have this issue, the LESS workaround is to override icon-font-path immediately after importing bootstrap:

@import "bootstrap/less/bootstrap.less";
@icon-font-path: "bootstrap/fonts/";

@cvrebert
Copy link
Collaborator

The method for changing the icon font location has been documented per #13340.

@cvrebert
Copy link
Collaborator

Also, there's a bug in less.js: less/less.js#1821

@ali1234
Copy link
Author

ali1234 commented Apr 25, 2014

The documentation isn't sufficiently clear.

If you are placing the icon font files elsewhere or changing their filenames

I haven't moved any bootstrap files at all, so it isn't clear that this documentation applies to the issue, unless you already understand the issue (in which case you don't need the documentation!)

Also I cannot reproduce that less.js bug.

@cvrebert
Copy link
Collaborator

Fair point, I'll add that case to the docs.

@cvrebert
Copy link
Collaborator

Addressed by #13435.

@mdo mdo added this to the v3.2.0 milestone May 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants