Skip to content

Commit 144efb5

Browse files
Updates an example of dealing with CLI module interface.
1 parent ff1be03 commit 144efb5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

README.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,20 @@ clean-css-cli can also be used as a module in a way of enhancing its functionali
329329
330330
var cleanCssCli = require('clean-css-cli');
331331
332-
return cleanCssCli(process, function beforeMinify(cleanCss) {
333-
cleanCss.options.level['1'].transform = function (propertyName, propertyValue) {
334-
if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) {
335-
return propertyValue.replace('url(', 'url(../valid/path/to/');
332+
var customPlugin = {
333+
level1: {
334+
value: function (propertyName, propertyValue, options) {
335+
if (propertyName == 'background-image' && propertyValue.indexOf('../valid/path/to') == -1) {
336+
return propertyValue.replace('url(', 'url(../valid/path/to/');
337+
} else {
338+
return propertyValue;
339+
}
336340
}
337341
}
342+
}
343+
344+
return cleanCssCli(process, function (cleanCss) {
345+
cleanCss.options.plugins.level1Value.push(customPlugin.level1.value);
338346
});
339347
```
340348

0 commit comments

Comments
 (0)