Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding support to Sweet #146

Closed
wants to merge 2 commits into from

2 participants

@joaomdmoura

There is this my opensource project called Sweet a precompiled language to html and decided integrate it with Tilt.

@judofyr
Collaborator

Any reason why you can't add the SweetTemplate in Sweet itself (in e.g. sweet/template)?

@joaomdmoura

I just tried to follow the pattern that I've found.

@judofyr judofyr modified the milestone: 2.1, 2.0.2
@judofyr judofyr added the planned label
@judofyr
Collaborator

I'm closing this now because it's been a while, and it doesn't look like Sweet gained any usage. Feel free to comment if you still want/need it.

@judofyr judofyr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2012
  1. @joaomdmoura
Commits on Mar 21, 2012
  1. @joaomdmoura
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 0 deletions.
  1. +3 −0  lib/tilt.rb
  2. +26 −0 lib/tilt/sweet.rb
  3. +2 −0  tilt.gemspec
View
3  lib/tilt.rb
@@ -145,6 +145,9 @@ def clear
require 'tilt/haml'
register HamlTemplate, 'haml'
+ require 'tilt/sweet'
+ register SweetTemplate, 's'
+
require 'tilt/css'
register SassTemplate, 'sass'
register ScssTemplate, 'scss'
View
26 lib/tilt/sweet.rb
@@ -0,0 +1,26 @@
+require 'tilt/template'
+
+module Tilt
+ # Sweet template implementation.
+ class SweetTemplate < Template
+ self.default_mime_type = 'text/html'
+
+ def self.engine_initialized?
+ defined? ::SweetLang
+ end
+
+ def initialize_engine
+ require_template_library 'sweet'
+ end
+
+ def prepare
+ @engine = ::SweetLang::Sweet.new
+ end
+
+ def precompiled_template(locals)
+ @engine.engine( data )
+ end
+
+ end
+end
+
View
2  tilt.gemspec
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
lib/tilt/css.rb
lib/tilt/erb.rb
lib/tilt/haml.rb
+ lib/tilt/sweet.rb
lib/tilt/liquid.rb
lib/tilt/markaby.rb
lib/tilt/markdown.rb
@@ -86,6 +87,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'creole'
s.add_development_dependency 'erubis'
s.add_development_dependency 'haml', '>= 2.2.11'
+ s.add_development_dependency 'sweet-lang'
s.add_development_dependency 'kramdown'
s.add_development_dependency 'less'
s.add_development_dependency 'liquid'
Something went wrong with that request. Please try again.