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/
Written by Bill Watts
Related protips
1 Response
Can i use slim in gh-pages ?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#