[TxMt] How do I create a new command in a bundle?

jgalt jgaltusa at gmail.com
Sat Apr 18 18:21:14 UTC 2015


I am trying to follow these instructions and I do not understand how to
create a new command. Can someone please explain how this is done?

https://coderwall.com/p/j7qqsa/minify-your-css-inside-of-textmate


In your Bundles menu, go to Edit Bundles and select your favorite CSS Bundle
(I am personally a huge proponent of mCss
<http://minimaldesign.net/downloads/tools/textmate-css-bundle> ). Add a new
Command, and enter make the command contents the following code:

# Create the minified filename
NEWFILE=${TM_FILENAME%\.css}'.min.css'

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

# And open it
mate $NEWFILE


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20150418/aa5b82d1/attachment.html>


More information about the textmate mailing list