<commit_before>wag
===

![Alt text](http://i.imgur.com/9eJTHZz.jpg "Web Asset Graph")

Web Asset Graph


### ?
wag parses a pile of HTML files, finds all references to assets (css, javascript, images, fonts) and re-writes the html in-place to point at these optimized assets.


This tool is inspired by assetgraph and assetgraph-builder.

### features
* fast
* simple API, only 500 lines of code
* renames files based on their MD5 hash so they can be cached forever
* prefixes assets with an optional CDN host
* compresses css, javascript, and images (jpg, png, svg)

### usage

[![NPM](https://nodei.co/npm/wag.png)](https://nodei.co/npm/wag/)


#### example
```sh
wag --inp /Users/mike/test-website/html \
    --out /Users/mike/test-website/public/optimized \
    --assets /Users/mike/test-website/public \
    --cdnroot //cdn.test-website.com
```

What this does:
1. Recursively find all HTML files in `test-website/html/` and subfolders
2. creates the `public/optimized/` directory and empties it
3. finds all css, images, javascripts, and font files references in the HTML files
4. minifies each file, renames them based on each file's md5 hash, and writes them to `public/optimized/`
   (e.g., `/public/images/dog.png` is re-rewritten to `/public/optimized/dog-343e32abce3968feac.png`)
5. Re-writes the URL for the asset to point at a CDN version (e.g., `/optimized/dog-343e32abce3968feac.png` is re-written to `//cdn.test-website.com/dog-343e32abce3968feac.png` )
<commit_msg>tweaked readme<commit_after>wag
===

![Alt text](http://i.imgur.com/9eJTHZz.jpg "Web Asset Graph")

Web Asset Graph


### ?
wag parses a pile of HTML files, finds all references to assets (css, javascript, images, fonts) and re-writes the html in-place to point at these optimized assets.


This tool is inspired by assetgraph and assetgraph-builder.

### features
* renames files based on their MD5 hash so they can be cached forever
* compresses css, javascript, and images (jpg, png, svg)
* prefixes assets with an optional CDN host
* simple API, only 500 lines of code

### usage

[![NPM](https://nodei.co/npm/wag.png)](https://nodei.co/npm/wag/)


#### example
```sh
wag --inp /Users/mike/test-website/html \
    --out /Users/mike/test-website/public/optimized \
    --assets /Users/mike/test-website/public \
    --cdnroot //cdn.test-website.com
```

What this does:
1. Recursively find all HTML files in `test-website/html/` and subfolders
2. creates the `public/optimized/` directory and empties it
3. finds all css, images, javascripts, and font files references in the HTML files
4. minifies each file, renames them based on each file's md5 hash, and writes them to `public/optimized/`
   (e.g., `/public/images/dog.png` is re-rewritten to `/public/optimized/dog-343e32abce3968feac.png`)
5. Re-writes the URL for the asset to point at a CDN version (e.g., `/optimized/dog-343e32abce3968feac.png` is re-written to `//cdn.test-website.com/dog-343e32abce3968feac.png` )

{'fraction_non_alphanumeric': 0.12466216216216217, 'fraction_numerical': 0.025675675675675677, 'mean_word_length': 3.79126213592233, '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': '5840545', 'n_tokens_mistral': 1088, 'n_tokens_neox': 991, 'n_words': 342}