Skip to content
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

Duplicate selectors when use each loop syntax #299

Closed
alireza-mh opened this issue Aug 11, 2019 · 4 comments
Closed

Duplicate selectors when use each loop syntax #299

alireza-mh opened this issue Aug 11, 2019 · 4 comments

Comments

@alireza-mh
Copy link

alireza-mh commented Aug 11, 2019

  • Operating System: MacOS 10.14.5
  • Node Version: 11.4.0
  • NPM Version: 6.9.0
  • webpack Version: 4.20.2
  • less-loader Version: 5.0.0

Expected Behavior

when we create selectors with each keywords, for example, in the main file if we import main file with reference keyword our output should not have duplicate selectors.

Actual Behavior

these kinds of selectors will be duplicated on the output file

Code

each(range(1, 5), {
 .flex-@{value} {
   flex: @value
 }
})

How Do We Reproduce?

copy and paste flex generator code in one file and import it with reference in other less files.

there is a workaround for those who faced the same issue, you can put all generated selectors in one file and import it once in your js file.

@ohcrfpv
Copy link

ohcrfpv commented Aug 12, 2019

same here

@alexander-akait
Copy link
Member

We don't modify you input, because less works like that

@alireza-mh
Copy link
Author

strange, it seems it is expected behavior according to this less issue:
less/less.js#3402

@alexander-akait
Copy link
Member

Yes, we can't do something on our side, maybe cssnano allow to you remove unnecessary selectors

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

3 participants