Permalink
Browse files

Modified sass method to allow :views_directory option and disable ren…

…dering of layouts.
  • Loading branch information...
1 parent 4144ac1 commit 95ca3f0c6939be54b2c48ae65626447b2684e60d @nmeans nmeans committed Apr 9, 2008
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/sinatra.rb
View
@@ -477,13 +477,17 @@ def render_haml(content, options = {}, &b)
# Generate valid CSS using Sass (part of Haml)
#
- # Sass templates can be in external files with +.sass+ extension or can use Sinatra's
+ # Sass templates can be in external files with <tt>.sass</tt> extension or can use Sinatra's
# in_file_templates. In either case, the file can be rendered by passing the name of
# the template to the +sass+ method as a symbol.
#
+ # Unlike Haml, Sass does not support a layout file, so the +sass+ method will ignore both
+ # the default <tt>layout.sass</tt> file and any parameters passed in as <tt>:layout</tt> in
+ # the options hash.
+ #
# === Sass Template Files
#
- # Sass templates can be stored in separate files with a +.sass+
+ # Sass templates can be stored in separate files with a <tt>.sass</tt>
# extension under the view path.
#
# Example:
@@ -523,9 +527,13 @@ def render_haml(content, options = {}, &b)
module Sass
- def sass(content)
+ def sass(content, options = {})
require 'sass'
- render(:sass, content)
+
+ # Sass doesn't support a layout, so we override any possible layout here
+ options[:layout] = false
+
+ render(:sass, content, options)
end
private

0 comments on commit 95ca3f0

Please sign in to comment.