-
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
import silent option #1210
Comments
from |
I keep forgetting to ask about a few things with this feature:
|
To answer your question, extends appear in the position of the silent This allows you to pull in a subset of a library.. e.g.
I have just pulled only navbar related styles from bootstrap. |
@lukeapage thanks for the clarification on this.
That's awesome! I didn't realize it would be as flexible (and powerful) as you're planning it to be. Very much looking forward to this. |
What if we either renamed this If there is potential for a command line option for this eventually we should consider changing one of the two above, especially since we're already getting some confusion on a couple of other import terms, "less" and "inline" in particular. |
Hadn't thought about that conflict.. good point. I don't think it will ever be a command line option but it is potentially confusing to have the same name. |
While |
👍 |
For instance, in MSI installers, the comment way to silence all output is with http://msdn.microsoft.com/en-us/library/windows/desktop/aa372024(v=vs.85).aspx And a search for "command line flag silent" certainly show a commonality as well. |
@Soviut we are saying to keep the command line as |
Wouldn't the disparity make it a bit confusing? An extra character for consistency's sake seems well worth it. |
@Soviut We want them to be different because they are completely different things! |
Oh! Sorry, in reading back through the original proposal, mute makes a lot of sense now. Coming from an animation background, the concept of "muting channels" in Maya was very common. It seems to fit the paradigm. |
implemented on the 1.4.1 branch |
That makes sense, but I have a related idea that I'd like to get your thoughts though. And I'm not sure if I should create another issue or feature request for this yet... I'd like your feedback on it and your help in clarifying what the actual request is and if you think I should create a request then I will. Okay, the "mute" feature is clearly for importing external files, but it's particularly well-suited for importing 3rd-party libraries that you don't want to have to "touch". This makes life super easy, it's extremely powerful. IMO it gets orders of magnitude more powerful if we can leverage this feature to make it even easier to import arbitrary external libraries and without having to directly add the import statements inside any I came up with a few different non-less.js hacks/workarounds to do this (using assemble-less in particular), but I'm wondering if there is a better, native Less.js solution that could work similarly to the |
oh I meant |
I like it. |
👍 |
Okay, I initially liked "mute", but after having third person tell me they hate it and that they don't see how it explains what the feature does, I think we should change it. All three people (including @cowboy), said they think the name should imply mixins or extends. That was my initial suggestion when we discussed this early on, and I still it makes a lot of sense. Even though this feature can be used via mixins or extends, when "muted" styles are extended, the behavior is virtually identical to how I described "extending mixins". Point being that, even though one might be using I'm of the opinion that we should change the keyword to mixin or mixins: From a documentation, education, feature description, and usability standpoint though, how easy and f'ing cool is it to say: "This feature enables you to turn any external library into a set of implicit mixins". Sign me up! |
okay.. that makes sense.. people like to think in terms of what it gives them, not what it is taking away - and I guess mute just tells you basically what it is doing, not why the hell you would want to do it. along those lines how about "reference" "library" "mixtend" (!?) "use"? my favourites in order: reference, library, mixins, use, mute, mixtend, mixin |
disclaimer: I'm more interested in the feature than the exact syntax - words aren't my strongest suit so happy to go with consensus |
I like the terms you proposed, and almost the same order as well. I'll focus on the first three though:
Another thought, each of the new import options kind of imply the word "as" before them:
I'd be okay with "as" being added to the actual options, but I'm not sure they're necessary because we could just explain it that way in the documentation. |
I've tried using the terms proposed by @lukeapage, as well as my own, in real code, and I also asked more people who were not familiar with the concept what made the most sense to them, and pretty unanimously everyone has liked Luke's first choice, What bothers me about "mute" (even though I proposed it) is that it implies that the CSS is somehow being "suppressed" or prevented from doing it's job. Btw Luke, I've spent quite a bit of time testing the code you implemented for this with Bootstrap and other libraries, and it works impressively well. Really beautiful work. I'd love to see it pushed up into a feature branch so that the early adopters can use it and provide feedback. |
I might get a break from putting up shelves in my new house in the next couple of weeks to be able to finish 1.4.0 and release it. Then I can release 1.4.1 as an alpha on npm.. |
@lukeapage are you good with "reference" then? Let's please get rid of mute. I regret suggesting it lol |
Yes.. codebase is already changed.. though maybe I need to generate a new |
Yeah, mute is bad. Sounds like it's related to audio. Of course silent is similar but often has a wider application than "mute". Silent is better than mute. "Reference" is... okay, I guess. "Library" starts to make more semantic logical sense (between reference and library). "Mixins" is probably the most misleading, since it suggests to me that only mixins are imported. I actually kinda like library. It's less verbose and obscure than reference. And it implies that they can be consumed (but in a different way) as opposed to "silent", which may imply to some that nothing happens. Still, not opposed to "silent", but of the other options suggested, "library" is best to me. But "reference" is also alright for the same reasons. I'd be okay with reference as well. Library COULD semantically apply that the feature is only for LESS libraries, when it really just means: "Don't produce any CSS output as a result of importing." i.e. "Silence" this output. ;-) So, my faves in order: silent, library, reference. |
@lukeapage I was just asking about the name, no other intentions, I don't have any opinion on the alpha. thanks! |
I've arrived to this thread while looking for support of silent classes in Less. By "silent class" (or "placeholder selectors"), I will refer you to Sass implementation of them (also). As I've read the conversation on this thread and didn't see them mentioned, I wonder if "silent classes" went under the radar. So, question is: does Less support (or is planning to support) silent classes? Sorry if I'm missing something obvious (n00b here) |
@maniqui this is one feature being proposed instead of placeholder selectors: #1177 And the other is |
Did |
We are now following semver so its planned for 1.5.0, due to beta soon. And we settled on reference. |
import takes the contents of the less file and puts it inline, as if the files were joined together. Silent continue to do this, but marks the contents as silent, so they can be referenced but not output. e.g.
current output...
output with silent (
@import (silent) "file.less";
)I see this as every selector in file.less is silenced, but if it is referenced it doesn't stop the use of it from being silent. I imagine this like a silent boolean property on root level selectors and directives - if a new selector is added to a ruleset then it still gets output.
usecase - powerful refactoring/ use of libraries.
only valid with a less file
The text was updated successfully, but these errors were encountered: