Skip to content

extend - support chaining #1213

@lukeapage

Description

@lukeapage

At the moment extend chaining does not work

.base {
    ...
}
.component:extend(.base) {
    ...
}
.super:extend(.component) {
    ...
}

.super will extend .component but no change will be made to selectors containing .base

suggestion:
In this example, we extend component in the same way and then re-run the extend, e.g.

.a {
}
.b:extend(.a) {
}
.c :extend(.b) {
}

becomes

.a,.b,.c {
}
.b, .c {
}
.c {
}

it essentially works by copying the selector (including the extend), doing the replace and then re-running the extend on the base. So the options for the base would still be applied

.a {
}
.a.b {
}
.b.e:extend(.a) {
}
.c :extend(.b all) {
}

.a, .b.e, .c.e {
}
.a.b, .a.c {
}
.b.e, .c.e {
}
.c {
}

note how .a.b is not extended with .c.e.b - the only addition is .c.e to .a

alternatively we decide the above is too complex and work out a simpler way for chaining to be implemented - or not implement it if it isn't asked for.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions