Skip to content

Instantly share code, notes, and snippets.

@shwoodard
Created July 4, 2010 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shwoodard/463200 to your computer and use it in GitHub Desktop.
Save shwoodard/463200 to your computer and use it in GitHub Desktop.
From ae93a6f6a5c91014da3aa7655ee8329e6e58294b Mon Sep 17 00:00:00 2001
From: Sam Woodard <sam.woodard@wildfireapp.com>
Date: Sat, 3 Jul 2010 23:00:15 -0700
Subject: add handling for scss files
---
lib/sinatra/base.rb | 5 +++++
lib/sinatra/tilt.rb | 10 ++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb
index 59b622f..c5b55b1 100644
--- a/lib/sinatra/base.rb
+++ b/lib/sinatra/base.rb
@@ -316,6 +316,11 @@ module Sinatra
render :sass, template, options, locals
end
+ def scss(template, options={}, locals={})
+ options[:layout] = false
+ render :scss, template, options, locals
+ end
+
def less(template, options={}, locals={})
options[:layout] = false
render :less, template, options, locals
diff --git a/lib/sinatra/tilt.rb b/lib/sinatra/tilt.rb
index 58adbe2..3d76fa7 100644
--- a/lib/sinatra/tilt.rb
+++ b/lib/sinatra/tilt.rb
@@ -513,6 +513,16 @@ module Tilt
end
register 'sass', SassTemplate
+ # Sass template implementation. See:
+ # http://haml.hamptoncatlin.com/
+ #
+ # Sass templates do not support object scopes, locals, or yield.
+ class ScssTemplate < SassTemplate
+ def prepare
+ @engine = ::Sass::Engine.new(data, sass_options.merge(:syntax => :scss))
+ end
+ end
+ register 'scss', ScssTemplate
# Lessscss template implementation. See:
# http://lesscss.org/
--
1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment