Need help with slim?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

5.1K Stars 498 Forks MIT License 1.8K Commits 75 Opened issues


Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic.

Services available


Need anything else?

Contributors list


Gem Version Build Status Code Climate Test Coverage Flattr donate button

Slim is a template language whose goal is to reduce the view syntax to the essential parts without becoming cryptic. It started as an exercise to see how much could be removed from a standard html template (<, >, closing tags, etc...). As more people took an interest in Slim, the functionality grew and so did the flexibility of the syntax.

A short list of the features...

  • Elegant syntax
    • Short syntax without closing tags (Using indentation instead)
    • HTML style mode with closing tags
    • Configurable shortcut tags (
      in the default configuration)
    • Safety
      • Automatic HTML escaping by default
      • Support for Rails'
    • Highly configurable
    • Extensible via the following plugins:
      • Logic less mode similar to Mustache
      • Includes
      • Translator/I18n
    • High performance
      • Comparable speed to ERB/Erubis
      • Streaming support in Rails
    • Supported by all major frameworks (Rails, Sinatra, ...)
    • Full Unicode support for tags and attributes
    • Embedded engines like Markdown and Textile
    • Links


      What is Slim?

      Slim is a fast, lightweight templating engine with support for Rails 3 and later. It has been heavily tested on all major ruby implementations. We use continuous integration (travis-ci).

      Slim's core syntax is guided by one thought: "What's the minimum required to make this work".

      As more people have contributed to Slim, there have been syntax additions influenced from their use of Haml and Jade. The Slim team is open to these additions because we know beauty is in the eye of the beholder.

      Slim uses Temple for parsing/compilation and is also integrated into Tilt, so it can be used together with Sinatra or plain Rack.

      The architecture of Temple is very flexible and allows the extension of the parsing and compilation process without monkey-patching. This is used by the logic less plugin and the translator plugin which provides I18n. In logic-less mode you can use Slim if you like the Slim syntax to build your HTML but don't want to write Ruby in your templates.

      Why use Slim?

      • Slim allows you to write very minimal templates which are easy to maintain and pretty much guarantees that you write well-formed HTML and XML
      • The Slim syntax is aesthetic and makes it more fun to write templates. Since you can use Slim as a drop-in replacement in all the major frameworks it is easy to adopt.
      • The Slim architecture is very flexible and allows you to write syntax extensions and plugins.

      Yes, Slim is speedy! Slim was developed right from the start with performance in mind. Benchmarks are done for every commit at Don't trust the numbers? That's as it should be. Please try the benchmark rake task yourself!

      However in our opinion you should use Slim because of its features and syntax. We just ensure that Slim doesn't have a negative impact on the performance of your application.

      How to start?

      Install Slim as a gem:

      gem install slim

      Include Slim in your Gemfile with

      gem 'slim'
      or require it with
      require 'slim'
      . That's it! Now, just use the .slim extension and you're good to go.

      Syntax example

      Here's a quick example to demonstrate what a Slim template looks like:

      doctype html
          title Slim Examples
          meta name="keywords" content="template language"
          meta name="author" content=author
          link rel="icon" type="image/png" href=file_path("favicon.png")
            alert('Slim supports embedded javascript!')

      body h1 Markup examples

        p This example shows you how a basic Slim file looks.
      == yield
      - if items.any?
          - for item in items
              td.price = item.price
      - else
        p No items found. Please add some inventory.
          Thank you!
      div id="footer"
        == render 'footer'
        | Copyright © #{@year} #{@author}

      Indentation matters, but the indentation depth can be chosen as you like. If you want to first indent 2 spaces, then 5 spaces, it's your choice. To nest markup you only need to indent by one space, the rest is gravy.

      Line indicators

      Verbatim text

      The pipe tells Slim to just copy the line. It essentially escapes any processing. Each following line that is indented greater than the pipe is copied over.

            This is a test of the text block.

      The parsed result of the above:

      This is a test of the text block.

      If the text starts on the same line, the left margin is set at the indent of the pipe + one space. Any additional spaces will be copied over.

          | This line is on the left margin.
             This line will have one space in front of it.
               This line will have two spaces in front of it.
                 And so on...

      You can also embed html in the text line

      - articles.each do |a|

      Verbatim text with trailing white space

      The single quote tells Slim to copy the line (similar to

      ), but makes sure that a single trailing white space is appended.

      Inline html

      You can write html tags directly in Slim which allows you to write your templates in a more html like style with closing tags or mix html and Slim style. The leading

      works like an implicit
          title Example
      - if articles.empty?
      - else
          - articles.each do |a|
      #{} #{a.description}

      Control code

      The dash denotes control code. Examples of control code are loops and conditionals.

      is forbidden behind
      . Blocks are defined only by indentation. If your ruby code needs to use multiple lines, append a backslash
      at the end of the lines. If your line ends with comma
      (e.g because of a method call) you don't need the additional backslash before the linebreak.
        - if articles.empty?
          | No inventory


      The equals sign tells Slim it's a Ruby call that produces output to add to the buffer. If your ruby code needs to use multiple lines, append a backslash

      at the end of the lines. For example:
      = javascript_include_tag \

      If your line ends with comma

      (e.g because of a method call) you don't need the additional backslash before the linebreak. For trailing or leading whitespace the modifiers
      are supported.
      • Output with trailing white space
        . Same as the single equals sign (
        ), except that it adds a trailing white space.
      • Output with leading white space
        . Same as the single equals sign (
        ), except that it adds a leading white space.

      Output without HTML escaping

      Same as the single equals sign (

      ), but does not go through the
      method. For trailing or leading whitespace the modifiers
      are supported.
      • Output without HTML escaping and trailing white space
        . Same as the double equals sign (
        ), except that it adds a trailing white space.
      • Output without HTML escaping and leading white space
        . Same as the double equals sign (
        ), except that it adds a leading white space.

      Code comment

      Use the forward slash for code comments - anything after it won't get displayed in the final render. Use

      for code comments and
      for html comments
          / This line won't get displayed.
            Neither does this line.
          /! This will get displayed as html comments.

      The parsed result of the above:

      HTML comment

      Use the forward slash immediately followed by an exclamation mark for html comments (


      IE conditional comment

      /[if IE]
          p Get a better browser.

      This renders as:


      HTML tags

      <!DOCTYPE> declaration

      The doctype keyword can be used to generate the complex doctypes in a very simple manner.


      doctype xml

      doctype xml ISO-8859-1


      doctype html

      doctype 5

      doctype 1.1

      doctype strict

      doctype frameset

      doctype mobile

      doctype basic

      doctype transitional


      doctype strict

      doctype frameset

      doctype transitional

      Closed tags (trailing

      You can close tags explicitly by appending a trailing

      img src="image.png"/

      Note, that this is usually not necessary since the standard html tags (img, br, ...) are closed automatically.

      Trailing and leading whitespace (

      You can force Slim to add a trailing whitespace after a tag by adding a

      a> href='url1' Link1
      a> href='url2' Link2

      You can add a leading whitespace by adding

      a< href='url1' Link1
      a< href='url2' Link2

      You can also combine both.

      a<> href='url1' Link1

      Inline tags

      Sometimes you may want to be a little more compact and inline the tags.

        li.first: a href="/a" A link
        li: a href="/b" B link

      For readability, don't forget you can wrap the attributes.

        li.first: a[href="/a"] A link
        li: a[href="/b"] B link

      Text content

      Either start on the same line as the tag

        h1 id="headline" Welcome to my site.

      Or nest it. You must use a pipe or an apostrophe to escape processing

        h1 id="headline"
          | Welcome to my site.

      Or enable and rely on smart text instead

        h1 id="headline"
          Welcome to my site.

      Dynamic content (

      Can make the call on the same line

        h1 id="headline" = page_headline

      Or nest it.

        h1 id="headline"
          = page_headline


      You write attributes directly after the tag. For normal text attributes you must use double

      or single quotes
      (Quoted attributes).
      a href="" title='Slim Homepage' Goto the Slim homepage

      You can use text interpolation in the quoted attributes.

      Attributes wrapper

      If a delimiter makes the syntax more readable for you, you can use the characters

      to wrap the attributes. You can configure these symbols (See option
        h1(id="logo") = page_logo
        h2[id="tagline" class="small tagline"] = page_tagline

      If you wrap the attributes, you can spread them across multiple lines:

         class="small tagline"] = page_tagline

      You may use spaces around the wrappers and assignments:

      h1 id = "logo" = page_logo
      h2 [ id = "tagline" ] = page_tagline

      Quoted attributes


      a href="" title='Slim Homepage' Goto the Slim homepage

      You can use text interpolation in the quoted attributes:

      a href="http://#{url}" Goto the #{url}

      The attribute value will be escaped by default. Use == if you want to disable escaping in the attribute.

      a href=="&"

      You can break quoted attributes with backslash

      a data-title="help" data-content="extremely long help text that goes on\
        and on and on and then starts over...."

      Ruby attributes

      Write the ruby code directly after the

      . If the code contains spaces you have to wrap the code into parentheses
      . You can also directly write hashes
      and arrays
          - for user in users
            td id="user_#{}" class=user.role
              a href=user_action(user, :edit) Edit #{}
              a href=(path_to_user user) =

      The attribute value will be escaped by default. Use == if you want to disable escaping in the attribute.

      a href==action_path(:start)

      You can also break ruby attributes with backslash

      or trailing
      as described for control sections.

      Boolean attributes

      The attribute values

      are interpreted as booleans. If you use the attribute wrapper you can omit the attribute assigment.
      input type="text" disabled="disabled"
      input type="text" disabled=true
      input(type="text" disabled)

      input type="text" input type="text" disabled=false input type="text" disabled=nil

      Attribute merging

      You can configure attributes to be merged if multiple are given (See option

      ). In the default configuration this is done for class attributes with the white space as delimiter. class="highlight" href=""

      This renders as:

      You can also use an

      as attribute value and the array elements will be merged using the delimiter.
      a class=["menu","highlight"]
      a class=:menu,:highlight

      Splat attributes

      The splat shortcut allows you to turn a hash into attribute/value pairs.

      .card*{'data-url'=>place_path(place), 'data-id'=>} =

      This renders as:

      Slim's house

      You can also use methods or instance variables which return a hash as shown here:

      .card *method_which_returns_hash =
      .card *@hash_instance_variable =

      The hash attributes which support attribute merging (see Slim option

      ) can be given as an
      .first *{class: [:second, :third]} Text

      This renders as:

      div class="first second third"

      Splat attributes prefix may be configured via

      option. Default value is

      Dynamic tags

      You can create completely dynamic tags using the splat attributes. Just create a method which returns a hash with the :tag key.

        def a_unless_current
          @page_current ? {tag: 'span'} : {tag: 'a', href: ''}
      - @page_current = true
      *a_unless_current Link
      - @page_current = false
      *a_unless_current Link

      This renders as:



      Tag shortcuts

      You can define custom tag shortcuts by setting the option

      . In Rails apps, you need to put this code for your shortcuts into an initializer like
      . In Sinatra, you simply add the same configuration anywhere below the line where you
      require 'slim'
      Slim::Engine.set_options shortcut: {'c' => {tag: 'container'}, '#' => {attr: 'id'}, '.' => {attr: 'class'} }

      We can use it in Slim code like this

      c.content Text

      which renders to


      Attribute shortcuts

      You can define custom shortcuts (Similar to

      for id and
      for class).

      In this example we add

      to create a shortcut for the input elements with type attribute.
      Slim::Engine.set_options shortcut: {'&' => {tag: 'input', attr: 'type'}, '#' => {attr: 'id'}, '.' => {attr: 'class'}}

      We can use it in Slim code like this

      &text name="user"
      &password name="pw"

      which renders to


      In another example we add

      to create a shortcut for the role attribute.
      Slim::Engine.set_options shortcut: {'@' => {attr: 'role'}, '#' => {attr: 'id'}, '.' => {attr: 'class'}}

      We can use it in Slim code like this

      [email protected] =

      which renders to


      You can also set multiple attributes with same value at once using one shortcut.

      Slim::Engine.set_options shortcut: {'@' => {attr: %w(data-role role)}}

      We can use it in Slim code like this

      [email protected] =

      which renders to


      You can also set additional fixed value attributes to a shortcut.

      Slim::Engine.set_options shortcut: {'^' => {tag: 'script', attr: 'data-binding',
        additional_attrs: { type: "text/javascript" }}}


        == @products.to_json

      which renders to


      ID shortcut
      and class shortcut

      You can specify the

      attributes in the following shortcut form
          = page_headline
          = page_tagline
          = show_content

      This is the same as

        h1 id="headline"
          = page_headline
        h2 id="tagline" class="small tagline"
          = page_tagline
        div class="content"
          = show_content

      Helpers, capturing and includes

      If you use Slim you might want to extend your template with some helpers. Assume that you have the following helper

      module Helpers
        def headline(&block)
          if defined?(::Rails)
            # In Rails we have to use capture!


      " else # If we are using Slim without a framework (Plain Tilt), # this works directly. "


      " end end end

      which is included in the scope that executes the Slim template code. The helper can then be used in the Slim template as follows

        = headline do
          ' Hello

      The content in the

      block is then captured automatically and passed to the helper via
      . As a syntactic sugar you can omit the
      keyword and write only
        = headline
          ' Hello

      Capturing to local variables

      Using the

      you can capture to local variables as follows:
      module Helpers
        def capture_to_local(var, &block)
          set_var = block.binding.eval("lambda {|x| #{var} = x }")
          # In Rails we have to use capture!
          # If we are using Slim without a framework (Plain Tilt),
          # you can just yield to get the captured block.
 ? capture(&block) : yield)

      The helper can then be used in the Slim template as follows

      / The captured_content variable must be known by the Binding beforehand.
      = capture_to_local captured_content=:captured_content
        p This will be captured in the variable captured_content
      = captured_content

      Another interesting use case is to use an enumerable and capture for each element. The helper could look like this

      module Capture
        def capture(var, enumerable = nil, &block)
          value = enumerable ? : yield
          block.binding.eval("lambda {|x| #{var} = x }").call(value)

      and it would be used as follows

      - links = { '' => 'The Slim Template Language' }
      = capture link_list=:link_list, links do |url, text|
        a href=url = text


      contains the captured content.

      Include helper

      If you want includes which are processed at compile time, you can take a look at Include partials. However you can also execute subtemplates at runtime (similar to Rails'

      ). You have to write your own include helper:
      module Helpers
        def include_slim(name, options = {}, &block)
"#{name}.slim", options).render(self, &block)

      This helper can then be used as follows

      nav = include_slim 'menu'
      section = include_slim 'content'

      However this helper doesn't do any caching. You should therefore implement a more intelligent version of the helper which fits your purposes. You should also be aware that most frameworks already bring their own include helper, e.g. Rails has


      Text interpolation

      Use standard Ruby interpolation. The text will be html escaped by default, but you can avoid escaping by using double braces.

        h1 Welcome #{} to the show.
        | Unescaped #{{content}} is also possible.

      To escape the interpolation (i.e. render as is)

        h1 Welcome \#{} to the show.

      Embedded engines (Markdown, ...)

      Thanks to Tilt, Slim has extensive support for embedding other template engines.


        square = (x) -> x * x

      markdown: #Header Hello from #{"Markdown!"} Second Line!

      p: markdown: Tag with inline markdown!

      Supported engines:

      | Filter | Required gems | Type | Description | | ------ | ------------- | ---- | ----------- | | ruby: | none | Shortcut | Shortcut to embed ruby code | | javascript: | none | Shortcut | Shortcut to embed javascript code and wrap in script tag | | css: | none | Shortcut | Shortcut to embed css code and wrap in style tag | | sass: | sass | Compile time | Embed sass code and wrap in style tag | | scss: | sass | Compile time | Embed scss code and wrap in style tag | | less: | less | Compile time | Embed less css code and wrap in style tag | | coffee: | coffee-script | Compile time | Compile coffee script code and wrap in script tag | | markdown: | redcarpet/rdiscount/kramdown | Compile time + Interpolation | Compile markdown code and interpolate #{variables} in text | | textile: | redcloth | Compile time + Interpolation | Compile textile code and interpolate #{variables} in text | | rdoc: | rdoc | Compile time + Interpolation | Compile rdoc code and interpolate #{variables} in text |

      The embedded engines can be configured in Slim by setting the options directly on the

      filter. Example:
      Slim::Embedded.options[:markdown] = {auto_ids: false}

      You can also specify HTML attributes for the following embedded engines: * Javascript * CSS * CoffeeScript * LESS * SASS * SCSS


      scss class="myClass":
        $color: #f00;
        body { color: $color; }

      This will generate the following HTML:


      Configuring Slim

      Slim and the underlying Temple framework are highly configurable. The way how you configure Slim depends a bit on the compilation mechanism (Rails or Tilt). It is always possible to set default options per

      class. This can be done in Rails' environment files. For instance, in config/environments/development.rb you probably want:

      Default options

      # Indent html for pretty debugging and do not sort attributes
      Slim::Engine.set_options pretty: true, sort_attrs: false

      You can also access the option hash directly:

      Slim::Engine.options[:pretty] = true

      Setting options at runtime

      There are two ways to set options at runtime. For Tilt templates (

      ) you can set the options when you instantiate the template:'template.slim', optional_option_hash).render(scope)

      The other possibility is to set the options per thread which is interesting mostly for Rails:

      Slim::Engine.with_options(option_hash) do
        # Any Slim engines which are created here use the option_hash
        # For example in Rails:
        render :page, layout: true

      You have to be aware that the compiled engine code and the options are cached per template in Rails and you cannot change the option afterwards.

      # First render call
      Slim::Engine.with_options(pretty: true) do
         render :page, layout: true

      Second render call

      Slim::Engine.with_options(pretty: false) do render :page, layout: true # :pretty is still true because it is cached end

      Available options

      The following options are exposed by the

      and can be set with
      . There are a lot of them but the good thing is, that Slim checks the configuration keys and reports an error if you try to use an invalid configuration key.

      | Type | Name | Default | Purpose | | ---- | ---- | ------- | ------- | | String | :file | nil | Name of parsed file, set automatically by Slim::Template | | Integer | :tabsize | 4 | Number of white spaces per tab (used by the parser) | | String | :encoding | "utf-8" | Set encoding of template | | String | :defaulttag | "div" | Default tag to be used if tag name is omitted | | Hash | :shortcut | {'.' => {attr: 'class'}, '#' => {attr: 'id'}} | Attribute shortcuts | | Hash | :codeattrdelims | {'(' => ')', '[' => ']', '{' => '}'} | Attribute delimiters for Ruby code attributes | | Hash | :attrlistdelims | {'(' => ')', '[' => ']', '{' => '}'} | Attribute list delimiter | | Array<Symbol,String> | :enableengines | nil (All enabled) | List of enabled embedded engines (whitelist) | | Array<Symbol,String> | :disableengines | nil (None disabled) | List of disabled embedded engines (blacklist) | | Boolean | :disablecapture | false (true in Rails) | Disable capturing in blocks (blocks write to the default buffer | | Boolean | :disableescape | false | Disable automatic escaping of strings | | Boolean | :usehtmlsafe | false (true in Rails) | Use String#htmlsafe? from ActiveSupport (Works together with :disableescape) | | Symbol | :format | :xhtml | HTML output format (Possible formats :html, :xhtml, :xml) | | String | :attrquote | '"' | Character to wrap attributes in html (can be ' or ") | | Hash | :mergeattrs | {'class' => ' '} | Joining character used if multiple html attributes are supplied (e.g. class="class1 class2") | | Array<String> | :hyphenattrs | %w(data) | Attributes which will be hyphenated if a Hash is given (e.g. data={afoo:1,b:2} will render as data-afoo="1" data-b="2") | | Boolean | :hyphenunderscoreattrs | false | Attributes that have underscores in their names will be hyphenated (e.g. data={afoo:1,bbar:2} will render as data-a-foo="1" data-b-bar="2") | | Boolean | :sortattrs | true | Sort attributes by name | | Symbol | :jswrapper | nil | Wrap javascript by :comment, :cdata or :both. You can also :guess the wrapper based on :format. | | Boolean | :pretty | false | Pretty HTML indenting, only block level tags are indented (This is slower!) | | String | :indent | ' ' | Indentation string | | Boolean | :streaming | false (true in Rails, see below how to disable it!) | Enable output streaming, improves the perceived performance | | Class | :generator | Temple::Generators::StringBuffer/ RailsOutputBuffer | Temple code generator (default generator generates string buffer) | | String | :buffer | 'buf' ('@outputbuffer' in Rails) | Variable used for buffer | | String | :splat_prefix | '*' | Prefix used for splat attributes |

      There are more options which are supported by the Temple filters but which are not exposed and are not officially supported. You have to take a look at the Slim and Temple code for that.

      Option priority and inheritance

      For developers who know more about Slim and Temple architecture it is possible to override default options at different positions. Temple uses an inheritance mechanism to allow subclasses to override options of the superclass. The option priorities are as follows:

      1. Slim::Template
        options passed at engine instantiation
      2. Slim::Template.options
      3. Slim::Engine.thread_options
      4. Parser/Filter/Generator

      It is also possible to set options for superclasses like

      . But this will affect all temple template engines then.
      Slim::Engine < Temple::Engine
      Slim::Compiler < Temple::Filter


      Slim currently provides plugins for logic less mode, includes and I18n. See the plugin documentation.

      Framework support


      Slim uses Tilt to compile the generated code. If you want to use the Slim template directly, you can use the Tilt interface.['template.slim'].render(scope)'template.slim', optional_option_hash).render(scope) { source }.render(scope)

      The optional option hash can have to options which were documented in the section above. The scope is the object in which the template code is executed.


      require 'sinatra'
      require 'slim'

      get('/') { slim :index }

      END @@ index doctype html html head title Sinatra With Slim body h1 Slim Is Fun!


      Rails generators are provided by slim-rails. slim-rails is not necessary to use Slim in Rails though. Just install Slim and add it to your Gemfile with

      gem 'slim'
      . Then just use the .slim extension and you're good to go.


      HTTP streaming is enabled by default if you use a Rails version which supports it. However you have to be aware that streaming only improves the perceived performance. The rendering time in total will increase. If you want to disable it use:

      Slim::RailsTemplate.set_options streaming: false


      Slim now supports Angular2 syntax. But you need to set some configuration options:


      This option tells parser what syntax to use for splat attributes. Default value is asterisk:

      splat_prefix: '*'
      Asterisk is also used in Angular2 for structural directives such as
      and others, so default configuration causes a conflict between slim and angular2 syntax.

      There are two ways to resolve it:

      • Set
        to any custom value, double asterisk, for example:
        splat_prefix: '**'
        . Now structural directives should work as expected. Remember that now splat attributes should be written with new custom prefix before them.
      • Use alternative directive syntax without asterisk.

      Attribute delimeters

      Angular and slim both uses brackets in their syntax. So there are also two ways: * Use alternative syntax for binding (

      and so on) * Limit attribute delimeters to curly braces only:
      code_attr_delims: {
       '{' => '}',
      attr_list_delims: {
       '{' => '}',

      Now you can use something like this:

      h1{ #var (bind1)="test" [bind2]="ok" [(bind3)]="works?" *ngIf="expr" *ngFor="expression" } {{it works}}

      Will be compiled to:

      {{it works}}


      Slim Command 'slimrb'

      The gem 'slim' comes with the small tool 'slimrb' to test Slim from the command line.

      $ slimrb --help
      Usage: slimrb [options]
          -s, --stdin                      Read input from standard input instead of an input file
              --trace                      Show a full traceback on error
          -c, --compile                    Compile only but do not run
          -e, --erb                        Convert to ERB
              --rails                      Generate rails compatible code (Implies --compile)
          -r, --require library            Load library or plugin with -r slim/plugin
          -p, --pretty                     Produce pretty html for debugging purposes
          -o, --option name=code           Set slim option
          -l, --locals Hash|YAML|JSON      Set local variables
          -h, --help                       Show this message
          -v, --version                    Print version

      Start 'slimrb', type your code and press Ctrl-d to send EOF. In Windows Command Prompt press Ctrl-z, Enter to send EOF. Example usage:

      $ slimrb
        First paragraph.
        Second paragraph.
        * one
        * two
        * three
      //Enter Ctrl-d
      <p>First paragraph </p>
      <p>Second paragraph </p>

      Syntax Highlighters

      There are plugins for various text editors (including the most important ones - Vim, Emacs and Textmate):

      Template Converters (HAML, ERB, ...)



      Yes, Slim is one of the fastest Ruby template engines out there! In production mode Slim is nearly as fast as Erubis (which is the fastest template engine). But we would be happy if you chose Slim also for any other reason, we assure you performance will not be an obstacle.

      Run the benchmarks with

      rake bench
      . You can add the option
      to run the slow parsing benchmark which needs more time. You can also increase the number of iterations.
      $ rake bench slow=1 iterations=1000

      We run the benchmarks for every commit on Travis-CI. Take a look at the newest benchmarking results:

      Test suite and continuous integration

      Slim provides an extensive test-suite based on minitest. You can run the tests with 'rake test' and the rails integration tests with 'rake test:rails'.

      We are currently experimenting with human-readable literate tests which are written as markdown files:

      Travis-CI is used for continuous integration testing:

      Slim is working well on all major Ruby implementations:

      • Ruby 2.0, 2.1, 2.2 and 2.3
      • JRuby 1.9 mode
      • Rubinius 2.0


      If you'd like to help improve Slim, clone the project with Git by running:

      $ git clone git://

      Work your magic and then submit a pull request. We love pull requests!

      Please remember to keep the compatibility with Ruby versions 2.0.0, 2.1.0, 2.2.0 and 2.3.0.

      If you find the documentation lacking, help us out and update this If you don't have the time to work on Slim, but found something we should know about, please submit an issue.


      Slim is released under the MIT license.


      Donations and sponsoring

      If you want to support this project please visit the Gittip and Flattr pages.

      Flattr donate button

      Currently the donations will be used to cover the hosting costs (domain name etc).


      Related projects

      Template compilation framework:

      Framework support:

      Syntax highlighting:

      Static code analysis:

      Template Converters (HAML, ERB, ...):

      Language ports/Similar languages:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.