-
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
config file - less.json #850
Comments
|
I actually think this idea is important, but I don't agree with the implementation. It's quite possible for two files in the same directory to have different configurations, or simply different output paths per file, and that's often true for my projects. For me, this is intuitively located in the root file that is being compiled. And I would construct it more like LESS / CSS, in a comment syntax. Like this: /// options {
/// cssOutput: "www/css/some.css";
/// minify: true;
/// ...etc
/// } Something like this is essential for file-based editors, and of course useful for shared projects, or simply preserving settings when migrating without re-configuring. UPDATE: Oh, now I see what you did. You're putting in a map for every file. ...And that file could just be located in the same folder as the file you're compiling. Well, frig, that's probably a better idea than modification of the source file. But then... it could be more like... {
"options" : {
"some.less" : {
css: "../css/some.css",
minify: true
}
}
} That leaves the door open to future configuration options being added. |
Does this make sense considering that |
as long as it just exposes the compiler functionality, I think its a good idea.. e.g. if we are just making less more configurable and flexible its good.. then the build tools can become more powerful :) |
This could be used to configure loading / debugging options in browser, or at compile time, or at load time of LESS files for editors. I actually need to do this anyway, but it would be nice to have an agreed-upon standard. |
I agree with @agatronic, the build tools are limited in what they can do with LESS. Look at grunt-contrib-less https://github.com/gruntjs/grunt-contrib-less/ as a good use case. There are a few things I can think of that could be set as options to make builds more powerful:
|
in the spirit of just continuing the dialog around ways to accomplish this, so we can move toward the agreed-upon standard mentioned by @MatthewDL, here are a couple of suggestions for how less could leverage the less.json files for configuration. Whether it ends up exactly like this or not isn't material, I just want the flexibility afforded by these options. In the examples I keep making use of "globals" (or whatever we want to label them), because I like the idea of not having to import those directly into each less file in order for it to compile separately. I thought of having objects for variables and mixins, but that doesn't make sense. The operative point is that it needs to be easier to have a separation of concerns in LESS files, without creating a big unmanageable mess. There may be other ways to accomplish this than what I've outlined, but I like this because it's clean and simple - especially if we can make the "globals" concept optional for projects where it doesn't make sense:
the first two objects, prod and dev, are just two examples of grabbing a library of less files and compiling to one css file, along with the option to minify or not. In both examples a path for less is defined, and a path for css is defined, since we do not need to compile more than one css file. the last object, components, shows each less file compiling to a separate css file. One more thought is that the "globals" concept adds a lot of value but it does not necessarily need to be included in this. If just the compiling options (using json) are implemented I'd be that much happier :) |
Damn, I totally missed that you gave great comments on this. Probably because I was taking care of a new human at the time. ;-) This thread could continue on #1134, but one thing that doesn't make sense is the inclusion of files. That seems utterly unnecessary. The parser will find those based on their include statements. It doesn't need them to be explicitly declared, and doing so would just add a maintenance headache. Otherwise, some great ideas here. |
lol, thanks and congrats! We have a two-year old. I was just through that myself! Yeah, I agree with your point about inclusion of files. After playing around with configurations similar to what I suggested for the last few months, I think I would do things differently now, like as I proposed in the issue you linked to. I think if you compare the Another cool thing about the |
Yes, for all the reasons above, it's a good idea. You've made a strong argument for the LESS/CSS-like syntax for an options block. Now we just need an implementation / pull request. |
@MatthewDL I'll take a shot at working up an implementation for this. |
@jonschlinkert yes, I was talking about the @options issue. |
@kievechua and anyone else - do you think the options should be json or are you happy for them to be less - if you are happy for them to be less, I am thinking we may as well close this. |
I think LESS syntax makes the most sense. We can assume anyone using LESS is familiar with CSS, however we should not assume they would be familiar with a different language and syntax such as JSON. |
I agree, let's close this for now so we can focus on LESS-flavored options. We can reopen if necessary. |
+1 to @Soviut's point, but looks like we resolved this anyway. |
Based on the further discussion that happened with @options, it looked like JSON may in fact work better to implement first (for build systems). Configuration is easier at the JS / JSON level, and makes sense to include parser directives in JavaScript. It's possible we could support both, but either way JSON should be one of those options, so we might as well implement first. |
Closing, discussion moved to #1893. |
Add config file less.json
so when I run
less .
it will compile based on the configJust like yuidoc's yuidoc.json
The text was updated successfully, but these errors were encountered: