UNPKG

7.16 kBMarkdownView Raw
1## lessrc
2Type: `String`
3
4Default: null
5
6A convenience option for externalizing task options into a `.lessrc` or `.lessrc.yml` file. If this file is specified, options defined therein will be used.
7
8## globalVars
9Type: `Object`
10
11Default: `undefined`
12
13Prepend variables to source files.
14
15## modifyVars
16Type: `Object`
17
18Default: `undefined`
19
20Append variables to source files.
21
22## metadata
23Type: `String|Array`
24
25Default: Empty string
26
27Pass metadata as context to Lo-Dash templates embedded in LESS files. The name of the files is used as the first path in the template variables, so if you want to use data from `palette.yml`, your templates would look something like: `<%= palette.foo %>`.
28
29Data may be formatted in `JSON`, `YAML`. See [this YAML example][1] and [this LESS example][2].
30
31_Note that data passed into `options.metadata` is merged at the task and target levels. You can turn this off by adding `options: {merge: false}`, which then disables merging and allows targets to override any data passed in at the task-level._
32
33## imports
34Type: `Object` (each option accepts a `String` or `Array`)
35
36Default: `null`
37
38Prepend `@import` statements to `src` files using any of the new `@import` directives released after Less.js v1.5.0, `less`, `css`, `inline`, `reference` (`multiple` and `once` probably aren't applicable here, but feel free to use them if you find a use case). See [examples](#usage-examples).
39
40_Any new import directives will be immediately available upon release by Less.js._
41
42## process
43Type: `Boolean|Object`
44
45Default: false
46
47Process source files as [templates][3] before concatenating.
48
49* `false` - No processing will occur.
50* `true` - Process source files using [grunt.template.process][4] defaults.
51* `options` object - Process source files using [grunt.template.process][4], using the specified options.
52* `function(src, filepath)` - Process source files using the given function, called once for each file. The returned value will be used as source code.
53
54_(Default processing options are explained in the [grunt.template.process][4] documentation)_
55
56## banner
57Type: `String`
58
59Default: Empty string
60
61This string will be prepended to the beginning of the concatenated output. It is processed using [grunt.template.process][4], using the default options.
62
63_(Default processing options are explained in the [grunt.template.process][4] documentation)_
64
65## stripBanners
66Type: `Boolean|Object`
67
68Default: false
69
70Strip JavaScript banner comments from source files.
71
72* `false` - No comments are stripped.
73* `true` - `/* ... */` block comments are stripped, but _NOT_ `/*! ... */` comments.
74* `options` object:
75 * By default, behaves as if `true` were specified.
76 * `block` - If true, _all_ block comments are stripped.
77 * `line` - If true, any contiguous _leading_ `//` line comments are stripped.
78
79## paths
80Type: `String|Array`
81
82Default: Directory of input file.
83
84Specifies directories to scan for `@import` directives when parsing. The default value is the directory of the specified source files. In other words, the `paths` option allows you to specify paths for your @import statements in the `less` task as an alternative to specifying a path on every `@import` statement that appears throughout your LESS files. So instead of doing this:
85
86``` css
87@import "path/to/less/files/mixins.less";
88```
89you can do this:
90
91``` css
92@import "mixins.less";
93```
94
95#### rootpath
96Type: `String`
97
98Default: `""`
99
100A path to add on to the start of every url resource.
101
102## compress
103Type: `Boolean`
104
105Default: `false`
106
107Compress output by removing some whitespaces.
108
109#### cleancss
110Type: `Boolean`
111
112Default: `false`
113
114Compress output using [clean-css](https://npmjs.org/package/clean-css).
115
116## ieCompat
117Type: `Boolean`
118
119Default: `true`
120
121Enforce the css output is compatible with Internet Explorer 8.
122
123For example, the [data-uri](https://github.com/cloudhead/less.js/pull/1086) function encodes a file in base64 encoding and embeds it into the generated CSS files as a data-URI. Because Internet Explorer 8 limits `data-uri`s to 32KB, the [ieCompat](https://github.com/cloudhead/less.js/pull/1190) option prevents `less` from exceeding this.
124
125## optimization
126Type: `Integer`
127
128Default: null
129
130Set the parser's optimization level. The lower the number, the less nodes it will create in the tree. This could matter for debugging, or if you want to access the individual nodes in the tree.
131
132## strictImports
133Type: `Boolean`
134
135Default: false
136
137Force evaluation of imports.
138
139## strictMath
140Type: `Boolean`
141
142Default: `false`
143
144When enabled, math is required to be in parenthesis.
145
146## strictUnits
147Type: `Boolean`
148
149Default: `false`
150
151When enabled, less will validate the units used (e.g. 4px/2px = 2, not 2px and 4em/2px throws an error).
152
153## syncImport
154Type: `Boolean`
155
156Default: `false`
157
158Read @import'ed files synchronously from disk.
159
160## dumpLineNumbers
161Type: `String`
162
163Default: `false`
164
165Configures -sass-debug-info support.
166
167Accepts following values: `comments`, `mediaquery`, `all`.
168
169## relativeUrls
170Type: `Boolean`
171
172Default: `false`
173
174Rewrite urls to be relative. false: do not modify urls.
175
176## customFunctions
177Type: `Object`
178
179Default: none
180
181Define custom functions to be available within your LESS stylesheets. The function's name must be lowercase and return a primitive type (not an object or array). In the function definition, the first argument is the less object, and subsequent arguments are from the less function call. Values passed to the function are not simple primitive types, rather types defined within less. See the LESS documentation for more information on the available types.
182
183## report
184Choices: `false`|`'min'`|`'gzip'`
185
186Default: `false`
187
188Either do not report anything, report only minification result, or report minification and gzip results. This is useful to see exactly how well Less is performing, but using `'gzip'` can add 5-10x runtime task execution.
189
190Example ouput using `'gzip'`:
191
192```
193Original: 198444 bytes.
194Minified: 101615 bytes.
195Gzipped: 20084 bytes.
196```
197
198## sourceMap
199Type: `Boolean`
200
201Default: `false`
202
203Enable source maps.
204
205## sourceMapFilename
206Type: `String`
207
208Default: none
209
210Write the source map to a separate file with the given filename.
211
212## sourceMapURL
213Type: `String`
214
215Default: none
216
217Override the default url that points to the sourcemap from the compiled css file.
218
219## sourceMapBasepath
220Type: `String`
221
222Default: none
223
224Sets the base path for the less file paths in the source map.
225
226## sourceMapRootpath
227Type: `String`
228
229Default: none
230
231Adds this path onto the less file paths in the source map.
232
233## outputSourceFiles
234Type: `Boolean`
235
236Default: `false`
237
238Puts the less files into the map instead of referencing them.
239
240## version
241Type: `String`
242
243Default: `less` (current release)
244
245Specify the directory containing the version of Less.js to use for compiling. You may specify a version at the task level or a different version for each target.
246
247```javascript
248less: {
249 options: {
250 version: 'vendor/less'
251 },
252 styles: {
253 files: {
254 'css/style.css': ['src/style.less']
255 }
256 }
257}
258```
259Useful for testing new features included in a beta or alpha release, or for comparing the compiled results from different versions of Less.js.
\No newline at end of file