1azr2w
Last Updated: February 25, 2016
·
1.608K
· billwatts
8851cdadff0650c026c953a27416c34c

Slim templates in Octopress

Love using Slim templates? Love Octopress? Want to hook these crazy kids up? That's what I was looking for this weekend.

module Jekyll
  require 'slim'
  class SlimConverter < Converter
    safe true
    priority :low

    def matches(ext)
      ext =~ /slim/i
    end

    def output_ext(ext)
      ".html"
    end

    def convert(content)
      begin
        Slim::Template.new { content }.render
      rescue StandardError => e
        puts "!!! SLIM Error: " + e.message
      end
    end
  end
end

Just add that to a new file and save it in the plugins folder of your Octopress site. Boom, now you can render your slim templates to static html.

Credit where credit is due: http://yobriefca.se/blog/2012/03/22/slim-generator-for-octopress/

Say Thanks
Respond

1 Response
Add your response

9578
F2af3ff36c10d206b74f68aacf68e08d

Can i use slim in gh-pages ?

over 1 year ago ·