Neil Ang


A stunning likeness of Neil Ang
Hello world

Slim slimmer

Posted on

As outlined in the Google HTML/CSS Style Guide and the HTML5 specification it is safe to omit certain start or end tags from your HTML.

Slim slimmer is an experimental gem I recently published to alter the slim template output to omit these tags.

So if your template looks like this:

doctype html
    title Example

    p Example

It will produce a slimmer and valid output like this:

<!DOCTYPE html>

N.B. At the moment the gem is very generic and does not implement all the removal rules outlined in the specification (e.g. not removing a tag if it is followed by whitespace or a HTML comment etc.).

Should I use this?

Besides being experimental, it is debatable whether this type of optimisation is worthwhile, and I would recommend reading this post from The Practical Dev.

I added the gem into my already tiny site is localhost down? - which produced a 1% reduction in size.