Skip to content

neilang/slim-slimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slim::Slimmer

Build Status

Experimental gem to automatically remove unnecessary html tags from your slim output.

As outlined in this styleguide and the HTML5 specification it is safe to omit certain start or end tags from your code.

This gem adds an extra processing step to convert this Slim code:

doctype html
html
  head
    title Example

  body
    p Example

To this html output:

<!DOCTYPE html>
<title>Example</title>
<p>Example

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.). Hopefully this detail can be added in a future release.

Installation

Add this line to your application's Gemfile:

gem 'slim-slimmer', github: 'neilang/slim-slimmer'

And then execute:

$ bundle

Usage

For best results it is recommended that you change the output format from xhtml to html as this removes the end slash in self-closing tags:

Slim::Engine.options[:format] = :html

You can optionally disable the slimmer feature via this configuration:

Slim::Engine.options[:slimmer] = false

About

Slim, only slimmer!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published