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

implicit mixin with variable class name #1836

Closed
tlindig opened this issue Jan 29, 2014 · 2 comments
Closed

implicit mixin with variable class name #1836

tlindig opened this issue Jan 29, 2014 · 2 comments

Comments

@tlindig
Copy link

tlindig commented Jan 29, 2014

I try to include definitions from a class of FontAwesome in my less files.
FontAwesome use class names, build at runtime with a variable to be able to support custom prefixes.

Here is an example I tried at less2css.org

.@{fa-css-prefix} { display: inline-block; }
.@{fa-css-prefix}-2x { font-size: 2em; }

.my-class {
  .@{fa-css-prefix};
  .@{fa-css-prefix}-2x;
}

@fa-css-prefix:       my-icon;

And I got the error message:

Parse error: Unrecognised input
.my-class {      .@{fa-css-prefix};        .@{fa-css-prefix}-2x;

I could only choose version 1.6.0 (current), 1.6.1 was not available in less2css.org.

What is wrong with this example? How can I get the implicit mixin?

@tlindig
Copy link
Author

tlindig commented Jan 29, 2014

After some more tries, I found a way. But is this the recommended solution?

I replaced the variable with it value.

.@{fa-css-prefix} { display: inline-block; }
.@{fa-css-prefix}-2x { font-size: 2em; }

.my-class {
  .my-icon;
  .my-icon-2x;
}

@fa-css-prefix: my-icon;

@seven-phases-max
Copy link
Member

In #1838 I linked to this SO topic with two possible solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants