Issue
I want to import all styles from another less file, but into a limited scope. I'm trying this:
"my-site.less"
.wrapper-class {
@import "path/to/styles.less";
}
But this doesn't work at all. I'm using the browser-based less.js option, and I can see the GET statement that is run when it actually does the import. But the resultant CSS does not contain any of the styles from the other sheet. If I do it like this, it works:
.wrapper-class
{
/* ... */
}
@import "path/to/styles.less";
But this defeats the original purpose. So is there any way to do a limited-scope @import like this in Less? Thanks!
Solution
According to the css-spec, the @import
-declaration has to come before all other declarations in the css-file. So your @import
inside the rule is expected to fail. I guess the @import
ing at the end of the file not failing is goodwill of the browser-vendors.
I guess LESS will abide by the same rules.
EDIT: the question is, why do you want to have those styles scoped? With proper declarations, this should not be necessary.
Answered By - Christoph
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.