Skip to content

@import (reference) and @media #2547

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
SebastienDaniel opened this issue Apr 10, 2015 · 5 comments
Closed

@import (reference) and @media #2547

SebastienDaniel opened this issue Apr 10, 2015 · 5 comments

Comments

@SebastienDaniel
Copy link

Using Grunt-contrib-less (1.0.1)

When importing a .less file containing @media queries, the styles within @media are imported even if the import directive is set to (reference), below is an example:

imported.less

@someColor: #121311;

h1 {
  color: @someColor;
}

@media (min-width: 600px) {
  h2 {
    color: #000;
  }
}

importer.less

@import (reference) "imported.less";

will output:

@media (min-width: 600px) {
  h2 {
    color: #000;
  }
}
@seven-phases-max
Copy link
Member

I can't reproduce this with either Less 2.4.0 or 2.5.0 (grunt-contrib-less 1.0.1 and 1.0.0 respectively)... Are you sure this minimal snippet is what that fails? (There're similar reference issues (e.g. #1968 + a few more), but the code as above should work fine).

@SebastienDaniel
Copy link
Author

I must admit I didn't test that quick example.

Here is a pastebin link (http://pastebin.com/dStVuRnf) to the file being IMPORTED, which is causing the unexpected output (i.e. the @media content being injected).

As an additional note, contrarily to the suggested duplicates, I'm not using any frameworks or libraries.

@seven-phases-max
Copy link
Member

Then it's #1851 (i.e. it's &:extend(...) that causes code to leak through reference there).

@seven-phases-max
Copy link
Member

Closing as a duplicate of #1851.

@SebastienDaniel
Copy link
Author

thx for the reference!

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