wag (Web Asset Graph)
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.
features
- compresses css, javascript, and images (jpg, png, svg)
- renames files based on their MD5 hash so they can be cached forever
- prefixes assets with an optional CDN host
- simple API, only 500 lines of code
usage
example
cd /Users/mike/test-website
wag --inp html --out optimized --assets public --cdnroot //cdn.test-website.com
What this does:
- Recursively find all HTML files in
test-website/html/
and subfolders - creates the
test-website/optimized/
directory and empties it - finds all css, images, javascripts, and font files referenced in the HTML files
- minifies each file, renames them based on each file's md5 hash, and writes them to
test-website/optimized/
(e.g.,test-website/public/images/dog.png
is re-rewritten totest-website/optimized/dog-343e32abce3968feac.png
) - Re-writes the URL for the asset to point at a CDN version (e.g.,
dog-343e32abce3968feac.png
is re-written to//cdn.test-website.com/dog-343e32abce3968feac.png
)
4.0.0
1 year ago
3.0.1
1 year ago
3.0.0
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago
11.0.0
1 year ago
0.0.0-0
1 year ago
1.5.0
1 year ago
0.0.105
1 year ago
0.0.104
1 year ago
0.0.103
1 year ago
0.0.10
1 year ago
0.0.102
1 year ago
0.0.101
1 year ago
0.0.100
1 year ago
1.2.2
8 years ago
1.2.1
9 years ago
1.2.0
9 years ago
1.1.0
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.5.4
10 years ago
0.5.3
11 years ago
0.5.2
11 years ago
0.5.1
12 years ago
0.5.0
12 years ago
0.4.4
12 years ago
0.4.3
12 years ago
0.4.2
12 years ago
0.4.1
12 years ago
0.4.0
12 years ago
0.3.2
12 years ago
0.3.1
12 years ago
0.3.0
12 years ago
0.2.2
12 years ago
0.2.1
12 years ago
0.1.1
12 years ago
0.1.0
12 years ago
0.0.9
12 years ago
0.0.8
12 years ago
0.0.7
12 years ago
0.0.6
12 years ago
0.0.5
12 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago
0.0.0
12 years ago