mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00

git-svn-id: svn://hamptoncatlin.com/haml/branches/1.5dev@174 7063305b-7217-0410-af8c-cdc13e5119b9
27 lines
682 B
Ruby
27 lines
682 B
Ruby
|
|
#Rails plugin stuff. For use with action_view
|
|
|
|
module Sass
|
|
module Plugin
|
|
|
|
def options
|
|
@@options
|
|
end
|
|
|
|
def stylesheet_location
|
|
@@options[:stylesheet_location] || (RAILS_ROOT + "/public/stylesheets/")
|
|
end
|
|
|
|
def sass_template(name)
|
|
file_location = stylesheet_location + name
|
|
if stylesheet_needs_update?(file_location)
|
|
file = File.open(file_location + ".css")
|
|
Sass::Engine.new.render(file_location + ".sass")
|
|
end
|
|
end
|
|
|
|
def stylesheet_needs_update?(file_location)
|
|
!File.exists?(file_location + ".css") || (File.mtime("#{file_location}.sass") - 60) > File.mtime("#{file_location}.css")
|
|
end
|
|
end
|
|
end
|