-
Notifications
You must be signed in to change notification settings - Fork 15
LESS compilation
The Aggregator provides a LESS module builder for compiling/minifying LESS stylesheets. The LESS module builder is an extension of the CSS Optimizer, and invokes the optimizer to process the output of the LESS compiler, so most of the options that apply to CSS files apply to LESS files as well.
In version 1.3.6 and later, you can define LESS global variables using the lessGlobals
Server-side AMD config property. This property is also supported by the CSS loader plugin for client loaded LESS files.
The lessGlobals
config property specifies a property map of variable name/value pairs (without the leading @
in the variable name). For the Server-side AMD config only, it may also specify a function that returns the property map. In the case of the function property, the function will be called to define the variables for each request and the code may call the in scope has()
function to query the values of features specified in the request. For example:
lessGlobals: function() {
return {
bidiLeft: has('RtlLanguage') ? 'right' : 'left'
};
}
Note that variable values defined in this way need to be quoted twice if the value contains any special characters that may be interpreted by the LESS compiler as operators. For example, if defining a path:
lessGlobals: {
mixinPath: '\"foo/bar/mixins.less\"'
}
You can then use the mixinPath
variable in a @import statement as follows:
@import @{mixinPath}