0.0.6 • Published 10 years ago

stylediff v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

stylediff

Computes the difference of stylesheets at parse tree level to generate a "diff" stylesheet.

build status

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

NameDefaultTypeDescription
stricttruebooleanWhen set to false referenced images are compared to their inlined verions will be marked as equal declaration
cwdprocess.cwd()stringStylesheet directory - required when strict mode is false