Skip to content

Commit

Permalink
Add a process option to the compiler (#349)
Browse files Browse the repository at this point in the history
* Add a process option to the compiler

* Better desc
  • Loading branch information
Luehrsen authored Feb 20, 2021
1 parent 7e8057c commit 94533ed
Show file tree
Hide file tree
Showing 8 changed files with 3,226 additions and 2 deletions.
15 changes: 14 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({

testVariable: 'success',

jshint: {
all: [
'Gruntfile.js',
Expand Down Expand Up @@ -251,7 +254,17 @@ module.exports = function(grunt) {
files: {
'tmp/modifyVars.css': ['test/fixtures/modifyVars.less']
}
}
},
processFunction: {
options: {
process: function( content ) {
return grunt.template.process( content );
}
},
files: {
'tmp/processFunction.css': ['test/fixtures/processFunction.less']
}
}
},

less_error: {
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ Overrides global variables. Equivalent to `--modify-vars='VAR=VALUE'` option in
Type: `String`
Default: none

## process
Type: `Function(content, destinationPath)`
Default: none
Attributes: content, destinationPath

Allows to parse the CSS content to be written to destinationPath to flow through a self defined function.

### Usage Examples

```js
Expand Down
7 changes: 7 additions & 0 deletions docs/less-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,10 @@ Overrides global variables. Equivalent to `--modify-vars='VAR=VALUE'` option in
## banner
Type: `String`
Default: none

## process
Type: `Function(content, destinationPath)`
Default: none
Attributes: content, destinationPath

Allows to parse the CSS content to be written to destinationPath to flow through a self defined function.
Loading

0 comments on commit 94533ed

Please sign in to comment.