Created
January 3, 2012 23:36
-
-
Save wojtekmach/1557585 to your computer and use it in GitHub Desktop.
Slim + handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tilt | |
class HandlebarsSlimTemplate < ::Slim::Template; end | |
register HandlebarsSlimTemplate, :handlebars_slim | |
end | |
class Slim::EmbeddedEngine | |
register :handlebars, TagEngine, tag: :script, attributes: { type: "text/x-handlebars" } | |
register :handlebars_slim, TagEngine, tag: :script, attributes: { type: "text/x-handlebars" }, engine: StaticTiltEngine | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@SergXIIIth You just need to include it in an initializer file (
/config/initializers/slim.rb
for example), then you will be able to use thehandlebars:
tag in your slim files.I'm assuming something changed with slim, but now
Slim::EmbeddedEngine
doesn't work anymore. I had to do justSlim::Embedded
instead.https://github.com/slim-template/slim/blob/master/lib/slim/embedded.rb#L63