diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zorglub/app.rb | 7 | ||||
-rw-r--r-- | lib/zorglub/engines/sass.rb | 23 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/zorglub/app.rb b/lib/zorglub/app.rb index 553dd3f..3d2819b 100644 --- a/lib/zorglub/app.rb +++ b/lib/zorglub/app.rb @@ -25,11 +25,16 @@ module Zorglub :ugly => false, :encoding => 'utf-8' }, + :sass_options => { + :syntax => :scss, + :cache => :false, + :style => :compressed + }, :session_options => { :enabled => false, :key => 'zorglub.sid', :secret => 'session-secret-secret', - :sid_len => 64, + :sid_len => 64 } } instance_eval &block if block_given? diff --git a/lib/zorglub/engines/sass.rb b/lib/zorglub/engines/sass.rb new file mode 100644 index 0000000..dd0eadb --- /dev/null +++ b/lib/zorglub/engines/sass.rb @@ -0,0 +1,23 @@ +# -*- coding: UTF-8 -*- +# +require 'sass/util' +require 'sass/engine' +# +module Zorglub + module Engines + module Sass + def self.proc path,obj + if obj.app.opt(:engines_cache_enabled) + key = path.sub obj.app.opt(:root),'' + sass = obj.app.engines_cache[key] ||= ::Sass::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:sass_options) ) + else + sass = ::Sass::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:sass_options) ) + end + css = sass.render + return css, 'text/css' + end + end + end +end +# +# EOF |