-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
:extend
to extend dynamically generated classes?
#1325
Comments
Technically this is a feature request for extending "non-existent" classes, since (in Less.js) dynamically generated classes can't be extended until after they are generated. Closing since the payoff isn't enough to justify the code debt. We might reconsider after 2.0, so feel free to continue the conversation here, but I think we'll need more uses cases than this to be convinced. |
Thanks for the feedback, jonschlinkert. Maybe a clean way to implement this could be with an option (a flag) to do a second pass? As for presenting more uses cases & arguments, I admit I will have to think a bit more to come up with some. But the basic, general one (that is: use case: to be able to :extend() dynamically generated classes) seems to go "in the spirit" of Less and CSS pre-processing in general. |
Ideas are always good, I can see your point about being "in the spirit of preprocessing". Let us know if you come up with more use cases (or anyone else), or if the needs is there we will reopen anytime. |
I think this should be left open? |
Just posting to share another kind of dynamically generated class names that cannot be extended:
As you can see, the |
I just stumbled upon this when trying to extend Font-Awesome classes which are defined like: .@{fa-css-prefix}-camera-retro { /* Stuff */ } So using: .my-icon :extend(.@{fa-css-prefix}-camera-retro) { /* Stuff */ } Doesn't work but it would be nice if it did. |
+1 for that feature |
I just noticed @lukeapage's comment about reopening. sounds good |
+1 for this. SASS has this feature, and it would put the two on more equal footing IMO |
How would this improve SASS? Lol wouldn't this make Less.js even better? jk |
Hi, I am new to Less but I find this problem to be quite annoying too. My use case is the same as @OrganicPanda's: I use Font-Awesome in my project and I alias some icons to more meaningful names to ease maintenance (see this code for instance). I would like to port this project from SASS to Less but this is a blocker. 😞 IMHO, it should not matter to me whether the classes I want to extend from has been dynamically generated or not: it is an implementation detail. At least you should put a warning concerning this behavior in the documentation. Thank you. |
There is a warning about this on the new documentation, my bad. |
+1 for this feature |
+1 for this |
I will take a look at doing it on the v2 branch. |
:extend
to extend dynamically generated classes? (interpolated identifier + concatenated identifier + variabe inside extend(...)
)
:extend
to extend dynamically generated classes? (interpolated identifier + concatenated identifier + variabe inside extend(...)
):extend
to extend dynamically generated classes?
I'm looking to extend some grid classes that are dynamically generated in Bootstrap 3.0.0.-wip.
I understand the answer to my question is no, according to this answer on SO.
So, I may have an answer now, but not a feature :)
I understand this is possible in Sass, as that's what is done in csswizardry-grids and unsemantic, which proves useful if used in tandem with silent classes.
I've been able to somewhat "replicate" the functionality by first compiling a set of .less file (in this case, Bootstrap's grid system), and, after that, then compiling a second set of .less files (my project) which imported the first compiled set (as if they were .less files).
The text was updated successfully, but these errors were encountered: