Doing some extra shit.
git-svn-id: svn://hamptoncatlin.com/haml/branches/1.5dev@177 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
fedcc42953
commit
e811263ced
7
init.rb
7
init.rb
|
@ -1,4 +1,7 @@
|
|||
require 'haml/template'
|
||||
require 'sass/plugin'
|
||||
require 'sass/sass_helper'
|
||||
|
||||
ActionView::Base.register_template_handler('haml', Haml::Template)
|
||||
ActionView::Base.register_template_handler('haml', Haml::Template)
|
||||
ActionView::Base.class_eval do
|
||||
include Sass::SassHelper
|
||||
end
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
require File.dirname(__FILE__) + '/css/parser'
|
||||
|
||||
module Sass
|
||||
|
|
|
@ -4,7 +4,7 @@ require File.dirname(__FILE__) + "/engine"
|
|||
#Rails plugin stuff. For use with action_view
|
||||
|
||||
module Sass
|
||||
module Plugin
|
||||
module SassHelper
|
||||
@@options = {}
|
||||
|
||||
class << self
|
||||
|
@ -24,8 +24,8 @@ module Sass
|
|||
end
|
||||
|
||||
def sass_template(name)
|
||||
file_location = Plugin._stylesheet_location + "/" + name.to_s
|
||||
if Plugin._always_update || Plugin.stylesheet_needs_update?(file_location)
|
||||
file_location = SassHelper._stylesheet_location + "/" + name.to_s
|
||||
if SassHelper._always_update || SassHelper.stylesheet_needs_update?(file_location)
|
||||
output_file = File.open(file_location + ".css", "w+")
|
||||
output_file << Sass::Engine.new.render_file(file_location + ".sass")
|
||||
output_file.close
|
|
@ -1,6 +1,5 @@
|
|||
require File.dirname(__FILE__) + '/../../lib/sass/engine'
|
||||
require File.dirname(__FILE__) + '/../../lib/sass/plugin'
|
||||
require File.dirname(__FILE__) + '/../../lib/sass/sass_helper'
|
||||
|
||||
class FakeController
|
||||
include Sass::Plugin
|
||||
include Sass::SassHelper
|
||||
end
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
require 'test/unit'
|
||||
require File.dirname(__FILE__) + '/../lib/sass/engine'
|
||||
require File.dirname(__FILE__) + '/../lib/sass/plugin'
|
||||
require File.dirname(__FILE__) + '/../lib/sass/sass_helper'
|
||||
require File.dirname(__FILE__) + '/mocks/fake_controller'
|
||||
|
||||
class SassPluginTest < Test::Unit::TestCase
|
||||
def setup
|
||||
Sass::Plugin.options[:stylesheet_location] = File.dirname(__FILE__) + '/sass'
|
||||
Sass::Plugin.options[:always_update] = true
|
||||
Sass::SassHelper.options[:stylesheet_location] = File.dirname(__FILE__) + '/sass'
|
||||
Sass::SassHelper.options[:always_update] = true
|
||||
@controller = FakeController.new
|
||||
end
|
||||
|
||||
|
@ -19,9 +19,9 @@ class SassPluginTest < Test::Unit::TestCase
|
|||
|
||||
def test_no_update
|
||||
base_file_location = base_file_location(:basic)
|
||||
assert Sass::Plugin.stylesheet_needs_update?(base_file_location)
|
||||
assert Sass::SassHelper.stylesheet_needs_update?(base_file_location)
|
||||
do_file_render :basic
|
||||
assert !Sass::Plugin.stylesheet_needs_update?(base_file_location)
|
||||
assert !Sass::SassHelper.stylesheet_needs_update?(base_file_location)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue