Skip to content

scoped import by reference problem #2097

Closed
@AoDev

Description

@AoDev

Hello,

let's say mixed.less contains classes and tag rules like this:

div {
    color: #000;
}

.black {
    color: #000;
}
  1. I import it unscoped in main.less:
@import (reference) "mixed.less";

outputs:

div {
    color: #000;
}
  1. I import it scoped like this:
.scope {
    @import (reference) "mixed.less";
}

outputs:

.scope div {
    color: #000;
}

.scope .black {
    color: #000;
}

I find this inconsistent. I would expect the same behaviour. So two questions:

  1. Is it normal that the html tag rules it outputted ? (please have a look here too: Better explain import by reference with html tag based rules. less-docs#205)

  2. Shouldn't we expect the same behaviour. I think that a scoped import should not count as an "active" call that would trigger rule's output. (except for tag based rules ?)

I have seen other import by reference issues, so it might be related. I use less 1.7.3 (grunt-contrib-less)

To better understand this, I have a widget. I use twitter bootstrap as a mixin library, and it must be scoped to avoid conflict if another website use bootstrap where the widget is inserted.

thx : )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions