Skip to content

Instantly share code, notes, and snippets.

View clipperhouse's full-sized avatar

Matt Sherman clipperhouse

View GitHub Profile
@clipperhouse
clipperhouse / gist:1201239
Created September 7, 2011 17:50
CSS minifier in one line
var minified = Regex.Replace(css, @"\s*([,>+;:}{]{1})\s*", "$1").Replace(";}", "}");
// ...where css is a string containing valid CSS
// There are several ways to optimize this; I would use a compiled regex and
// put it in an extension method for ease of use
public static class Extensions {
static Extensions() // static constructor