Less.js: Extend dynamically generated selectors (summary).

Created on 18 Sep 2014  路  16Comments  路  Source: less/less.js

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.

feature request medium priority up-for-grabs

Most helpful comment

馃啓

All 16 comments

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).

+1

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

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

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

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

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?

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).

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

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

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

Indeed. Hello copy-paste. Fixed now.

馃啓

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

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

@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/

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

Was this page helpful?
0 / 5 - 0 ratings