HTML Muncher is a command line utility written in Python that rewrites classes and ids in CSS, HTML, and JavaScript files in order to save precious bytes and obfuscate your code. View source on this page to see it in action.
OR

The HTML muncher is used with the Vimeo Universal Player for all embeds.
View source on this video to see what it looks like:
Enter some html with inline css and/or javascript and click "munch":
You still have to do work on the server side to tell your site to use the optimized versions of the files
A simple muncher command looks like this:
There are many arguments you can use:
comma separated list of html/view files or directories to process
if there is a file view.html the new file created will be view.opt.html
if there is a directory views a new directory will be created views_opt
comma separated list of css files or directories to process
comma separated list of js files or directories to process
comma separated list of classes and ids to ignore
this looks like .ignore_class,#ignore_id,#ignore_other_id
these classes and ids will not be renamed by the muncher
view extension to look for if a directory is passed in for --html argument
defaults to html
strips new line characters to compress html files specified with --html
be careful with this because it has not been thoroughly tested
comments using // instead of /* */ could end up commenting out a lot of code
js framework to use when processing js files
current options are jquery or mootools
comma separated list of css-like selectors used in javascript
for example if you used $.qs("#id > .class") then you would pass in qs
document.querySelector is added by default
comma separated list of selectors for selecting an id by string
for example if you have a method addId("name") you would pass in addId
getElementById is added by default
comma separated list of selectors for selecting a class by string
getElementsByClassName, hasClass, addClass, and removeClass are added by default
path to a js file containing class name/id constants
while the muncher does a pretty good job finding classes and ids in javascript, javascript is a dynamic language so there is definitely the possibility that it won't find everything.
a js manifest file is a javascript file that contains a list of all the class names and ids.when this is passed into the muncher it will only rename the classes/ids found in this file.the other files will still reference them as variables
more information about using a manifest file coming soon
when using a manifest file this will take any constants with values as strings and rewrite the values to be numbers
this is useful for development so you can debug the constants and see what they are without having to look up a number each time
* required argument
* passing in js selector values is not perfect but because javascript is such a dynamic language it is somewhat necessary to try to find classes and ids to rename
assigning class names or ids to variables in javascript will not work when using the muncher unless you use a js-manifest file
©2013 craig campbell