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
@import inside a selector (feature request) #656
Comments
+1. Would definitely be helpful. |
+1 |
+1 Please add this! |
I've found a dirty hack to allow namespaced imports. Just comment the following lines: https://github.com/cloudhead/less.js/blob/master/lib/less/tree/ruleset.js#L20 and https://github.com/cloudhead/less.js/blob/master/lib/less/tree/ruleset.js#L27 to look like
But I have no clue what this also affects on compiling. I've done a small test with bootstrap from Twitter:
Compiles down to:
And It has worked in my case. Can anyone confirm this on a larger project? @cloudhead Why is importing only executed on the root level? And why is Thanks |
Here's the patched fork: Just checkout and do a -Marc |
gonna fix this |
@cloudhead +1 & thanks |
|
Ah yes, there was a reason, it's a performance issue. I'll see if I can add a cli flag. |
Ok, done.. it's on by default, as performance hit was not that high.. option to disable is |
Thanks! This is a great improvement. |
Thanks @marcboeker and @cloudhead Saved me a ton of work with this change. :) |
Allowing imports inside of selectors would open up an awesome collection of possibilities for code reuse and style scoping. Something like:
Would prove especially useful for creating less modules for CSS backed widgets. For example, if I author e.g., AutoRotator and a StackContainer and had the ability to nest imports inside selectors, then I could do:
And the user of either library would be able to decide the scope of the various styles like:
Notice how simple the selectors seem inside the files. I think this basically just simulates http://www.w3.org/TR/css3-namespace/
The text was updated successfully, but these errors were encountered: