Both lessc and less.js can now be provided with global variables that
all .less files will have immediate access to. This can be used to
provide, for example, a base path for an @import, signed URLs offering
temporary access to an image on S3, or anything else.
lessc has two new parameters, --global-var and --modify-var. Both take
a value of the form "varname=value". --global-var declares variables
immediately before the content of the .less files, and --modify-var
declares them after.
--global-var is used when rules, imports, or other variables will depend
on the provided variable.
--modify-var is used to override a variable declared within the .less
file.
less.js's equivalent for global variables is less.globalVars. This can
be set before loading less.js. There is no new requivalent to
--modify-var, as less.modifyVars can be used for that purpose.
According to the w3 spec for Window:
http://www.w3.org/TR/Window/#location
`location.port` might be null. This PR checks that it is truthy before checking for the port's length.
One place where location.port is null is within [jsdom](https://github.com/tmpvar/jsdom), so if you run less within Node, within jsdom, it throws an exception in this code.
This will control the amount of logging in the javascript console that
less will do while parsing.
Options are:
2 - Information and errors
1 - Errors
0 - None
Defaults to 2
It is up to the parser and compiler to rewrite them when those files are
imported by another LESS file.
- Modified and added test cases for import and import-once rules
- Fixed difference between client side and server side handling of relative urls
- Added a -rootpath option to lessc to specify another base path for the url
rewriting. By default, rootpath=''
The function "modifyVars" the option to modify variables in the
less-file without reloading less-file, including potential
import-files declared with "@import".