Skip to content

TextMate: Local CSS Validation

Categories: Uncategorized

Table of Contents

Although TextMate comes with a built in CSS validation command it would sometimes fail for me depending on where I was working from (some locations have proxy software on the main router). I rewrote the command in the style of the PHP-HTML validator I posted earlier. You can add more validation options using -F. I’ve only used this script on CSS only files, it might not work on inline CSS in HTML documents.

[code lang=”bash”]#!/usr/bin/env ruby -wKU

scope =
scope.gsub!(/< /?style.*?>/, ”)

open(‘|curl -sF file=@-;type=text/css -F lang=en’, ‘r+’) do |io|
io < < scope io.close_write while io.gets $_.gsub!(//, ‘&’)
print $_

Keep in Touch

Subscribe to my email list to keep in touch. I’ll send you new blog posts and other thoughts.