stylediff
v0.0.6
Published
Computes the difference of stylesheets at parse tree level to generate a "diff" stylesheet.
Downloads
7
Maintainers
Readme
stylediff
Computes the difference of stylesheets at parse tree level to generate a "diff" stylesheet.
Installation
This module is installed via npm:
$ npm install stylediff --save-dev
Example Usage
var stylediff = require('stylediff');
var fs = require('fs');
var css1 = fs.readFileSync('test/fixtures/styles_a1.css','utf8');
var css2 = fs.readFileSync('test/fixtures/styles_a2.css','utf8');
stylediff(css1,css2, function(err,out){
fs.writeFileSync('test/fixtures/diff.css',out);
});
styles_a1.css:
.visible-print {
display: none !important;
}
th.visible-print,
td.visible-print {
display: table-cell !important;
color: green;
}
styles_a2.css:
.visible-print {
display: none !important;
}
td.visible-print {
color: green;
}
th.visible-print {
display: table-cell !important;
}
result.css:
td.visible-print {
display: table-cell!important;
}
th.visible-print {
color: green;
}
Options
| Name | Default | Type | Description |
| ------- | --------------- | ------------- | ------------- |
| strict | true
| boolean
| When set to false
referenced images are compared to their inlined verions will be marked as equal declaration |
| cwd | process.cwd()
| string
| Stylesheet directory - required when strict mode is false
|