Skip to content

scoped import by reference problem #2097

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

Closed
AoDev opened this issue Jul 6, 2014 · 2 comments
Closed

scoped import by reference problem #2097

AoDev opened this issue Jul 6, 2014 · 2 comments

Comments

@AoDev
Copy link

AoDev commented Jul 6, 2014

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

@seven-phases-max
Copy link
Member

See #1896.

For the moment the best known workaround for this kind of problems is using bootstrap.css instead of less files, e.g.:

.namespace {
    @import (less, reference) "bootstrap.css";
}

@seven-phases-max
Copy link
Member

Closing as duplicate of #1896.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants