-
Notifications
You must be signed in to change notification settings - Fork 3.4k
import statements options issue #3359
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
Comments
Are you saying you're getting imports duplicated? Note that using the same filename twice in one file doesn't make sense, so I feel like there's something contrived about this example that doesn't map to what's really being used. Is there a repo or online project that demonstrates how this is actually being used? |
As You mentioned "Note that using the same filename twice in one file doesn't make sense", it make sense in some cases beacause i can define some variables in one file and i can import it under any classes ,so check it up the example |
@mohamedafzal03 🤔 There's no reason to do that because the variables you import in the top level will be accessible within that class. I suspect you may have some misconceptions either about how vars and/or how imports work? |
what if i want to import variables in only some classes which is not imported in top level? |
You can do this. & {
@import "themes/haha/variable.less";
.class {
// etc
}
} |
dude @matthew-dean test.less
h1.less
h2.less ( example )
as per docs**onceThe default behavior of @import statements. It means the file is imported only once and subsequent import statements for that file will be ignored.
** |
I'm not quite sure I can follow the discussion - but I suspect this is basically one of faulty cases I mentioned in #3374 (comment)
Do you actually mean:
? |
@seven-phases-max
i.e when once is not effective only in the cases where the once option is written on the file which is imported in another file with multiple option .check it out ! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
//index.less
@import (multiple) "foo.less";
@import (multiple) "foo.less";
//foo.less
@import (once) "themes/haha/variable.less";
@import (once) "themes/haha/variable.less";
//themes/haha/variable.less
.className{
color:red;
}
css created by less compiler : (the "once" import option did not make sense here)
.className{
color:red;
}
.className{
color:red;
}
.className{
color:red;
}
.className{
color:red;
}
The text was updated successfully, but these errors were encountered: