Make Ruby Sass the default, but use SassC if available. Addresses #1648
This commit is contained in:
parent
b4697e4541
commit
6de88a832e
4 changed files with 17 additions and 11 deletions
|
@ -1,12 +1,5 @@
|
|||
require 'sass'
|
||||
|
||||
SASS_MODULE = begin
|
||||
require 'sassc'
|
||||
::SassC
|
||||
rescue LoadError => e
|
||||
::Sass
|
||||
end
|
||||
|
||||
module Middleman
|
||||
module Renderers
|
||||
# Sass renderer
|
||||
|
@ -59,11 +52,17 @@ module Middleman
|
|||
def evaluate(context, _)
|
||||
@context ||= context
|
||||
|
||||
@engine = SASS_MODULE::Engine.new(data, sass_options)
|
||||
sass_module = if defined?(::SassC)
|
||||
::SassC
|
||||
else
|
||||
::Sass
|
||||
end
|
||||
|
||||
@engine = sass_module::Engine.new(data, sass_options)
|
||||
|
||||
begin
|
||||
@engine.render
|
||||
rescue SASS_MODULE::SyntaxError => e
|
||||
rescue sass_module::SyntaxError => e
|
||||
::Sass::SyntaxError.exception_to_css(e)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -105,7 +105,13 @@ module Middleman
|
|||
end
|
||||
end
|
||||
|
||||
::SassC::Script::Functions.send :include, ::Middleman::Sass::Functions
|
||||
SASS_MODULE = if defined?(::SassC)
|
||||
::SassC
|
||||
else
|
||||
::Sass
|
||||
end
|
||||
|
||||
SASS_MODULE::Script::Functions.send :include, ::Middleman::Sass::Functions
|
||||
|
||||
# module SASS_MODULE::Script::Functions
|
||||
# include ::Middleman::Sass::Functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue