mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Make sass option support backwards-compatible
This commit is contained in:
parent
d359dc9c4d
commit
5b2dfebbf0
2 changed files with 9 additions and 1 deletions
|
@ -247,7 +247,7 @@ module Sinatra
|
|||
|
||||
def sass(template, options={}, &block)
|
||||
require 'sass' unless defined? ::Sass::Engine
|
||||
opts = options[:sass_options] || options.delete(:options) || {}
|
||||
opts = options[:sass_options] || options.delete(:sass) || {}
|
||||
opts = self.class.sass.merge(opts) if self.class.respond_to?(:sass)
|
||||
options.merge! :layout => false, :sass_options => opts
|
||||
render :sass, template, options
|
||||
|
|
|
@ -42,6 +42,14 @@ describe "Sass Templates" do
|
|||
assert_equal "#sass { background-color: #FFF; color: #000; }\n", body
|
||||
end
|
||||
|
||||
it "passes backwards compatible SASS options to the Sass engine" do
|
||||
sass_app {
|
||||
sass "#sass\n :background-color #FFF\n :color #000\n", :sass => {:style => :compact}
|
||||
}
|
||||
assert ok?
|
||||
assert_equal "#sass { background-color: #FFF; color: #000; }\n", body
|
||||
end
|
||||
|
||||
it "passes default SASS options to the Sass engine" do
|
||||
mock_app {
|
||||
set :sass, {:style => :compact } # default Sass style is :nested
|
||||
|
|
Loading…
Add table
Reference in a new issue