<commit_before># crass

A CSS minification, pretty printing, and general utility library written in JS.

[![Build Status](https://travis-ci.org/mattbasta/crass.png?branch=master)](https://travis-ci.org/mattbasta/crass)

## Why Crass?

Crass is one of only a handful of CSS minifiers that creates a full parse tree
of the CSS. Most other CSS minifiers operate on the string source instead,
which makes it impossible to perform all types of optimizations.

**Pros:**

- Better minification, particularly after gzip
- Support for consistent pretty printing
- Support for settled CSS4 and all of CSS3
- Ability to strip obsolete tags (removed prefixes, old standard specs, etc.) by browser version
- Convert all colors to their smallest possible form
- Unsafe optimizations are opt-in only

**Cons:**
- Slower minification times
- Cannot minify CSS with syntax errors
- Certain "CSS hacks" that use invalid syntax are unsupported


## Installation

Crass 1.8 is built with ES2015 and requires Node 4.6.2 or higher.

```sh
npm install --save-dev crass
```


## API

```js

var crass = require('crass');

// Parse any valid CSS stylesheet:<commit_msg>Fix README<commit_after># crass

A CSS minification, pretty printing, and general utility library written in JS.

[![Build Status](https://travis-ci.org/mattbasta/crass.png?branch=master)](https://travis-ci.org/mattbasta/crass)

## Why Crass?

Crass is one of only a handful of CSS minifiers that creates a full parse tree
of the CSS. Most other CSS minifiers operate on the string source instead,
which makes it impossible to perform all types of optimizations.

**Pros:**

- Better minification, particularly after gzip
- Support for consistent pretty printing
- Support for settled CSS4 and all of CSS3
- Ability to strip obsolete tags (removed prefixes, old standard specs, etc.) by browser version
- Convert all colors to their smallest possible form
- Unsafe optimizations are opt-in only

**Cons:**
- Slower minification times
- Cannot minify CSS with syntax errors
- Certain "CSS hacks" that use invalid syntax are unsupported


## Installation

Crass 0.8 is built with ES2015 and requires Node 4.6.2 or higher.

```sh
npm install --save-dev crass
```


## API

```js

var crass = require('crass');

// Parse any valid CSS stylesheet:
{'fraction_non_alphanumeric': 0.08395277656318322, 'fraction_numerical': 0.009619588981198076, 'mean_word_length': 4.271889400921659, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4750422', 'n_tokens_mistral': 673, 'n_tokens_neox': 644, 'n_words': 302}