1 | ## lessrc
|
2 | Type: `String`
|
3 |
|
4 | Default: null
|
5 |
|
6 | A 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
|
9 | Type: `Object`
|
10 |
|
11 | Default: `undefined`
|
12 |
|
13 | Prepend variables to source files.
|
14 |
|
15 | ## modifyVars
|
16 | Type: `Object`
|
17 |
|
18 | Default: `undefined`
|
19 |
|
20 | Append variables to source files.
|
21 |
|
22 | ## metadata
|
23 | Type: `String|Array`
|
24 |
|
25 | Default: Empty string
|
26 |
|
27 | Pass 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 |
|
29 | Data 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
|
34 | Type: `Object` (each option accepts a `String` or `Array`)
|
35 |
|
36 | Default: `null`
|
37 |
|
38 | Prepend `@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
|
43 | Type: `Boolean|Object`
|
44 |
|
45 | Default: false
|
46 |
|
47 | Process 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
|
57 | Type: `String`
|
58 |
|
59 | Default: Empty string
|
60 |
|
61 | This 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
|
66 | Type: `Boolean|Object`
|
67 |
|
68 | Default: false
|
69 |
|
70 | Strip 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
|
80 | Type: `String|Array`
|
81 |
|
82 | Default: Directory of input file.
|
83 |
|
84 | Specifies 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 | ```
|
89 | you can do this:
|
90 |
|
91 | ``` css
|
92 | @import "mixins.less";
|
93 | ```
|
94 |
|
95 | #### rootpath
|
96 | Type: `String`
|
97 |
|
98 | Default: `""`
|
99 |
|
100 | A path to add on to the start of every url resource.
|
101 |
|
102 | ## compress
|
103 | Type: `Boolean`
|
104 |
|
105 | Default: `false`
|
106 |
|
107 | Compress output by removing some whitespaces.
|
108 |
|
109 | #### cleancss
|
110 | Type: `Boolean`
|
111 |
|
112 | Default: `false`
|
113 |
|
114 | Compress output using [clean-css](https://npmjs.org/package/clean-css).
|
115 |
|
116 | ## ieCompat
|
117 | Type: `Boolean`
|
118 |
|
119 | Default: `true`
|
120 |
|
121 | Enforce the css output is compatible with Internet Explorer 8.
|
122 |
|
123 | For 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
|
126 | Type: `Integer`
|
127 |
|
128 | Default: null
|
129 |
|
130 | Set 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
|
133 | Type: `Boolean`
|
134 |
|
135 | Default: false
|
136 |
|
137 | Force evaluation of imports.
|
138 |
|
139 | ## strictMath
|
140 | Type: `Boolean`
|
141 |
|
142 | Default: `false`
|
143 |
|
144 | When enabled, math is required to be in parenthesis.
|
145 |
|
146 | ## strictUnits
|
147 | Type: `Boolean`
|
148 |
|
149 | Default: `false`
|
150 |
|
151 | When enabled, less will validate the units used (e.g. 4px/2px = 2, not 2px and 4em/2px throws an error).
|
152 |
|
153 | ## syncImport
|
154 | Type: `Boolean`
|
155 |
|
156 | Default: `false`
|
157 |
|
158 | Read @import'ed files synchronously from disk.
|
159 |
|
160 | ## dumpLineNumbers
|
161 | Type: `String`
|
162 |
|
163 | Default: `false`
|
164 |
|
165 | Configures -sass-debug-info support.
|
166 |
|
167 | Accepts following values: `comments`, `mediaquery`, `all`.
|
168 |
|
169 | ## relativeUrls
|
170 | Type: `Boolean`
|
171 |
|
172 | Default: `false`
|
173 |
|
174 | Rewrite urls to be relative. false: do not modify urls.
|
175 |
|
176 | ## customFunctions
|
177 | Type: `Object`
|
178 |
|
179 | Default: none
|
180 |
|
181 | Define 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
|
184 | Choices: `false`|`'min'`|`'gzip'`
|
185 |
|
186 | Default: `false`
|
187 |
|
188 | Either 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 |
|
190 | Example ouput using `'gzip'`:
|
191 |
|
192 | ```
|
193 | Original: 198444 bytes.
|
194 | Minified: 101615 bytes.
|
195 | Gzipped: 20084 bytes.
|
196 | ```
|
197 |
|
198 | ## sourceMap
|
199 | Type: `Boolean`
|
200 |
|
201 | Default: `false`
|
202 |
|
203 | Enable source maps.
|
204 |
|
205 | ## sourceMapFilename
|
206 | Type: `String`
|
207 |
|
208 | Default: none
|
209 |
|
210 | Write the source map to a separate file with the given filename.
|
211 |
|
212 | ## sourceMapURL
|
213 | Type: `String`
|
214 |
|
215 | Default: none
|
216 |
|
217 | Override the default url that points to the sourcemap from the compiled css file.
|
218 |
|
219 | ## sourceMapBasepath
|
220 | Type: `String`
|
221 |
|
222 | Default: none
|
223 |
|
224 | Sets the base path for the less file paths in the source map.
|
225 |
|
226 | ## sourceMapRootpath
|
227 | Type: `String`
|
228 |
|
229 | Default: none
|
230 |
|
231 | Adds this path onto the less file paths in the source map.
|
232 |
|
233 | ## outputSourceFiles
|
234 | Type: `Boolean`
|
235 |
|
236 | Default: `false`
|
237 |
|
238 | Puts the less files into the map instead of referencing them.
|
239 |
|
240 | ## version
|
241 | Type: `String`
|
242 |
|
243 | Default: `less` (current release)
|
244 |
|
245 | Specify 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
|
248 | less: {
|
249 | options: {
|
250 | version: 'vendor/less'
|
251 | },
|
252 | styles: {
|
253 | files: {
|
254 | 'css/style.css': ['src/style.less']
|
255 | }
|
256 | }
|
257 | }
|
258 | ```
|
259 | Useful 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 |