Last Updated: February 25, 2016
· liquidise

Minify Your CSS inside of Textmate

read more at: Ben Roux's Blog

In your Bundles menu, go to Edit Bundles and select your favorite CSS Bundle (I am personally a huge proponent of mCss). Add a new Command, and enter make the command contents the following code:

# Create the minified filename

# Minify into that file
curl -X POST -s --data-urlencode "input@${TM_FILENAME}" \
    http://www.cssminifier.com/raw > $NEWFILE

# And open it

You can make your key equivalent anything you'd like, I set mine to Cmd + Shift + R. Once you have done this, give it a whirl. You should see that your styles.css generates a styles.min.css in the same directory, as well as opens it in Textmate.

To note: if you don't have the Textmate command line utility installed, simply delete the last line of this command to stop seeing errors.