summaryrefslogtreecommitdiffstats
path: root/lib/zorglub/engines/sass.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zorglub/engines/sass.rb')
-rw-r--r--lib/zorglub/engines/sass.rb23
1 files changed, 23 insertions, 0 deletions
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