Skip to content

Commit 94533ed

Browse files
authored
Add a process option to the compiler (#349)
* Add a process option to the compiler * Better desc
1 parent 7e8057c commit 94533ed

File tree

8 files changed

+3226
-2
lines changed

8 files changed

+3226
-2
lines changed

Gruntfile.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ module.exports = function(grunt) {
1212

1313
// Project configuration.
1414
grunt.initConfig({
15+
16+
testVariable: 'success',
17+
1518
jshint: {
1619
all: [
1720
'Gruntfile.js',
@@ -251,7 +254,17 @@ module.exports = function(grunt) {
251254
files: {
252255
'tmp/modifyVars.css': ['test/fixtures/modifyVars.less']
253256
}
254-
}
257+
},
258+
processFunction: {
259+
options: {
260+
process: function( content ) {
261+
return grunt.template.process( content );
262+
}
263+
},
264+
files: {
265+
'tmp/processFunction.css': ['test/fixtures/processFunction.less']
266+
}
267+
}
255268
},
256269

257270
less_error: {

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ Overrides global variables. Equivalent to `--modify-vars='VAR=VALUE'` option in
166166
Type: `String`
167167
Default: none
168168

169+
## process
170+
Type: `Function(content, destinationPath)`
171+
Default: none
172+
Attributes: content, destinationPath
173+
174+
Allows to parse the CSS content to be written to destinationPath to flow through a self defined function.
175+
169176
### Usage Examples
170177

171178
```js

docs/less-options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,10 @@ Overrides global variables. Equivalent to `--modify-vars='VAR=VALUE'` option in
138138
## banner
139139
Type: `String`
140140
Default: none
141+
142+
## process
143+
Type: `Function(content, destinationPath)`
144+
Default: none
145+
Attributes: content, destinationPath
146+
147+
Allows to parse the CSS content to be written to destinationPath to flow through a self defined function.

0 commit comments

Comments
 (0)