Description
Hello,
This is a fairly simple option which I'd like to see in less.js.
It would look like this: @import (optional) "filename";
or @import-optional (reference) "filename";
(this way it can be combined to other import options)
If less does not find the file marked as optional
, it won't fail and just continue the compiling process.
The use case is the following:
Less.js is part of a build process. (grunt based)
During this process, there are specific cases when we want to override the default styles. There are already variables than can be overridden for example.
@import "variables.less";
@import "mixins.less";
@import "buttons.less";
...
When we want to override the variables, we need
- to copy the file containing the previous code
- modify the code to add a new import
- copy the file with the overrides in the same dir
@import "variables.less";
@import "overridden-variables.less";
@import "mixins.less";
@import "buttons.less";
...
If we don't do that, less will fail when overridden-variables.less
is not there.
It would be much easier to mark some files as optional that won't cause a problem if they are not present and this simplifies the build process.
What do you think?
Thanks for reading