Validate on Save for TextMate

I’ve been using TextMate almost exclusively for years for writing all kinds of code, shell scripts, PHP, Ruby, JavaScript, HTML, CSS… it’s one of those programs that excels at the thing that it does, and the thing that it does is get out of the way and let you do your thing.

I never seemed to outgrow it. Nearly everytime I’ve wanted it to do something, either someone else put something together or I’ve been able to extend it by writing my own commands or modifying an existing one.

One of the things I’ve done is bind the shortcut to save (cmd+s) to also validate my PHP or Ruby. Total time saver. If you’re a web developer you’re probably well aware of the save/switch/refresh/crash/switch/fix/save dance that one does between code editor and browser.

Recently, I decided to package it all up and throw in a couple other validators into it, and thusly the Validate on Save TextMate Bundle was born. This bundle will bind the save shortcut for you, and validate your PHP, Ruby, JavaScript, and CSS.

If you’re running Compass (a framework to Sass‘s CSS abstraction)1 this tool will try to compile your Sass files and return any errors it outputs.

If you install with Git using the instructions in the README, you’ll have instant access to updates, just click the Bundles > Validate On Save > Update Bundle menu command.

There are a few other configuration options in there, like using Growl for notification or jumping directly to the line the validator found errors, but in both cases, the results were a bit iffy so you’ll have to enabled those (by following the helpful instructions).

I showed an early version of this to my friend Jim Myhrberg, who refused to let me get away with distributing my messy code, so he did a ton of reorganization and cleanup that ultimately make this even easier for us to perhaps someday add more validators.

  1. If you have no idea what I’m talking about but write CSS, do yourself a favor and check it out. Highly recommended. 

Bookmarks for March 8th

In Regards to iWork.com

iWork.comIn the excitement about Apple’s beta version of iWork.com – the web-based document sharing/collaborating feature of their iWork suite – people have been asking about fonts. Specifically, what happens when you use a font that that isn’t available on the receiving end of the shared document?

I thought immediately of the news that the nightly builds of Webkit support downloadable fonts. All it takes is a couple lines of CSS and, as Jobs would say, “Boom.” Webkit is cross-platform (Apple even ships Safari for Windows), open source, and arguably one of the most popular mobile browsers. No longer will Mac users have the excuse that they can’t work with anyone else, were they to use iWork. Apple benefits from the increased usage of Webkit and Safari and they get to show off how great their iWork documents look to users unfamiliar to Apple’s software aesthetic.

Why wouldn’t they do it that way? Digital Rights Management (or rather, the lack thereof).

Font foundries typically have strictly defined licences for their fonts, though there isn’t anything technical standing in the way of breaking those licenses1. As DRM is slowly losing ground (if Apple’s “One Last Thing” from the Macworld Expo Keynote was any indication), will Apple drag the typography industry into the 21st century, into a landscape currently limited to a tiny handful of fonts? One can only hope.

Addendum:

In section 5 of the iWork.com Terms of Service, Apple says:

Changes to Content You understand that in order to provide the Service and make your Content available thereon, Apple may transmit your Content across various public networks, in various media, and modify or change your Content to comply with technical requirements of connecting networks or devices. You agree that the license herein permits Apple to take any such actions.

(emphasis mine)

  1. I should clarify, it would be neither the content creators sharing the documents that would be breaking the license, nor the user viewing the document on the web, but the individual that downloaded the font and used it without being granted the license to do so. It’s a distinction that needs to be made clear.