# stylediff

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

Latest version **0.0.6** (published 2014-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install stylediff
pnpm add stylediff
yarn add stylediff
bun add stylediff
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2014-08-22 |
| First published | 2014-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben Zörb |
| Maintainers | bezoerb |
| Keywords | critical-path css diff stylesheet |

## Links

- npm: https://www.npmjs.com/package/stylediff
- Repository: https://github.com/bezoerb/stylediff
- Issues: https://github.com/bezoerb/stylediff/issues
- npm.io page: https://npm.io/package/stylediff

## Dependencies (7)

- [css](https://npm.io/package/css.md) ^2.1.0
- [mime](https://npm.io/package/mime.md) ^1.2.11
- [svgo](https://npm.io/package/svgo.md) ^0.4.5
- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [es-hash](https://npm.io/package/es-hash.md) ^1.0.4
- [bluebird](https://npm.io/package/bluebird.md) ^2.3.0
- [clean-css](https://npm.io/package/clean-css.md) ^2.2.13

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2014-08-22
- 0.0.5 — 2014-07-31
- 0.0.4 — 2014-07-31

## README

# stylediff

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


[![build status](https://secure.travis-ci.org/bezoerb/stylediff.svg)](http://travis-ci.org/bezoerb/stylediff)

## Installation

This module is installed via npm:

``` bash
$ npm install stylediff --save-dev
```

### Example Usage

``` js
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:
```css
.visible-print {
    display: none !important;
}

th.visible-print,
td.visible-print {
    display: table-cell !important;
    color: green;
}
```
styles_a2.css:
```css
.visible-print {
    display: none !important;
}

td.visible-print {
    color: green;
}

th.visible-print {
    display: table-cell !important;
}
```
result.css:
```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` |

---
_Source: https://npm.io/package/stylediff · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
