Skip to content

String interpolation, list and !important keyword #2374

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

Open
SomMeri opened this issue Jan 8, 2015 · 5 comments
Open

String interpolation, list and !important keyword #2374

SomMeri opened this issue Jan 8, 2015 · 5 comments

Comments

@SomMeri
Copy link
Member

SomMeri commented Jan 8, 2015

I noticed something odd about string interpolation and lists:

.test-list {
  content: "@{variable}" !important;
  @variable: This is !important;
}

compiles into:

.test-list {
  content: "This is" !important;
}

I would expect it to be:

.test-list {
  content: "This is !important" !important;
}

I think it is just a minor issue, because following works correctly:

.test-string {
  content: "@{variable}" !important;
  @variable: "This is !important";
}
@lukeapage
Copy link
Member

Its weird though.. intrigues me..

@lukeapage lukeapage added the bug label Jan 11, 2015
@lukeapage
Copy link
Member

To fix this, you would change quoted to add a new important scope so that interpolating variables doesn't set important on the rule it is used in. In addition you would have to change variable interpolation to add !important to the quoted value.

But I'm having 2nd thoughts. Take this

.test-list {
  color1: "@{color}";
  color2: ~"@{color}";
  color3: ~"@{color}" !important;
  @color: black !important;
}

gives

.test-list {
  color1: "black" !important;
  color2: black !important;
  color3: black !important;
}

Now, this seems more useful to me.. I can't think of a solid example either way, so now I'm wondering whether to change it...

@matthew-dean
Copy link
Member

That seems interesting but not critical, since it looks like it only has slightly different behavior with !important?

@lukeapage
Copy link
Member

not sure I understand - that is the bug.

@matthew-dean
Copy link
Member

I know, what I meant to say is that it seems like it would rarely, if ever, be encountered, if it only happens with @SomMeri's specific construction. The collapse of !important (like your example) seems intuitive, since you'd never want !important !important.

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