Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Added support for default variables #1104
You can now define default variables via
This is useful for frameworks (e.g. Bootstrap) which need to define
Sass has this feature and it is used in the SASS-fork of Bootstrap and comes in quite handy.
This pull-request is based on #313 but with a test and the changes moved to the right places.
You can now define default variables via `@var: 1px !default;`. It will behave as `@var: 1px;` if `@var` hasnt't been defined yet. Otherwise it will be ignored. This is useful for frameworks (e.g. Bootstrap) which need to define variables to work but want to allow the user of the framework to change them without messing with the internal less-stylesheets.
Nice to see you back, your unit and media bubbling work is great.
at the moment people have to put a variables file last and those definitions override earlier ones.. this would require bootstrap to put !default after every variable definition and would mean people could override a variable by putting it first..
could you go into the benefits and the scenario that requires this more?
I wrote a small CSS-framework for some of my private/freelance projects. I'm using Bootstrap as an example because it is public and has a similar (near identical) structure to mine and I think it also could benefit from the
When you do
Now for example you want to change
Add variable after bootstrap
Cons: Doesn't affect bootstrap.
Do it "the way it's supposed to be done"
Cons: This makes updating to a newer Bootstrap difficult. You need to extract your local changes of
Define your own
that is pretty strange if it's the node.js framework.. It could be a timing issue or a bug..
It took some debate to agree that the last definition should be used, not the last before the current rule's definition.. and there are some up and down sides to it. If it is changed then this would definitely be needed.