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

Class is undefined if build with empty string. #3124

Closed
Mighty683 opened this issue Oct 23, 2017 · 5 comments
Closed

Class is undefined if build with empty string. #3124

Mighty683 opened this issue Oct 23, 2017 · 5 comments

Comments

@Mighty683
Copy link

If you build class with empty string for example:
@variable: ~''; .a@{variable}-b { a-b: 1 }
Output will be: .a-b { a-b: 1 } and this class can be used.
But if you try use .a-b class in another class as mixin for example:
.c { .a-b; }
Error 'a-b' is undefined will be present.
.c { .a-b; } will work only if you declare a-b class this way .a-b { a-b: 1 }.

@matthew-dean
Copy link
Member

That's neat but what's the real use case here? Why is an empty string getting injected into a class name like that and why would you ever need it?

@Mighty683
Copy link
Author

Mighty683 commented Oct 27, 2017

I was generating class for different media queries in loop. For example:
className-xs
className-lg
className-md
And wanted to generate non-media overall class named className. It's problem when you want generate classes in loop and one of variants is ~''.
I had to workaround this by adding this class outside the loop.

@seven-phases-max
Copy link
Member

This is a duplicate of #2831.

@seven-phases-max
Copy link
Member

Closing as a duplicate of #2831.

@seven-phases-max
Copy link
Member

As for the use-case itself (regardless of the bug) - it's the same story as in #2831: Never reuse CSS classes as mixins, use real mixins instead (for a detailed description on why this suggestion is so bold see #2702).

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