less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Extend dynamically generated selectors (summary).

Open seven-phases-max opened this issue 12 years ago • 16 comments

This ticket is to replace (mostly for the sake of clear minimal examples): #1325 #1539 #1597

It includes two distinct sub-features that require internal selector re-parsing:


[1]. Extend interpolated selector:

@var: a;

@{var} {
  color: red;
}

b:extend(a) {}

Expected result:

a, b {
  color: red;
}

[2]. Extend concatenated selector:

a {
  &b {
    color: blue;
  }
}

c:extend(ab) {}

Expected result:

ab, c {
  color: blue;
}

Related but pretty much independent feature of using a variable as an extend argument, i.e. :extend(@{var}), is clearly specified in #1485 and not included here.

seven-phases-max avatar Sep 18 '14 18:09 seven-phases-max

Strictly speaking [2] is not even a "dynamically generated selector" but it's almost always mentioned with [1] examples so they are merged here for more easy tracking. (Though these two sub-features don't have to be implemented simultaneously).

seven-phases-max avatar Sep 18 '14 18:09 seven-phases-max

+1

awcross avatar Sep 16 '15 15:09 awcross

When are this feature will done? It's great and very useful.

Pestov avatar Nov 01 '15 23:11 Pestov

I can imagine that this requires fundamental changes to some internals, but it should really be higher priority. :+1:

pcwinters avatar Dec 09 '15 17:12 pcwinters

Do we have an idea of what needs to be changed to support this? I'm more than willing to help out.

just-be-dev avatar Dec 10 '15 04:12 just-be-dev

It's just about adding the corresponding modifications to the extend implementation.

seven-phases-max avatar Dec 10 '15 10:12 seven-phases-max

Also, what about #1485? You mentioned it's a separate feature, but would the changes needed to make this work cover that use case as well?

just-be-dev avatar Dec 10 '15 12:12 just-be-dev

Honestly I'm not sure I understand the question. These are really three separate features from both usage and development perspective (neither one depends on the other and there's just a little overlapping between them from a technical point of view).

seven-phases-max avatar Dec 10 '15 14:12 seven-phases-max

Ahh, I see. I assumed that the two issues would share the same technical solution. Thanks for clearing that up.

just-be-dev avatar Dec 10 '15 14:12 just-be-dev

Is example 2 correctly written? I'm not sure why @var: a exists in that example.

matthew-dean avatar May 05 '16 19:05 matthew-dean

I'm not sure why @var: a exists in that example.

Indeed. Hello copy-paste. Fixed now.

seven-phases-max avatar May 05 '16 22:05 seven-phases-max

🆙

zxcabs avatar Feb 14 '17 11:02 zxcabs

Can't wait for this feature to each LESS 3 ;)

DennisJohnsen avatar Aug 14 '17 10:08 DennisJohnsen

Hello everyone ! I can't find any news about this issue... Is it fixed ??

guillaume-duchemin avatar Sep 18 '18 14:09 guillaume-duchemin

@guillaume-duchemin @seven-phases-max

#1 in the example now works as of the current release, #2 does not. You can see them here: http://lesscss.org/less-preview/

matthew-dean avatar Sep 18 '18 17:09 matthew-dean

Since this is partially fixed and #1597 contains the part that is not addressed, I'm going to close this and re-open #1597.

matthew-dean avatar Sep 18 '18 17:09 matthew-dean