Sha256: d8024f76f90e5e01aa82baf277377bb36101d29de3570aafac53f760bd480aa8

Contents?: true

Size: 1.34 KB

Versions: 15

Compression:

Stored size: 1.34 KB

Contents

require 'sass/plugin'

# XXX: We can remove this monkeypatch once Sass 2.2 is released.
module Sass::Plugin

  # splits the stylesheet_needs_update? method into two pieces so I can use the exact_stylesheet_needs_update? piece
  module StylesheetNeedsUpdate
    def stylesheet_needs_update?(name, template_path, css_path)
      css_file = css_filename(name, css_path)
      template_file = template_filename(name, template_path)
      exact_stylesheet_needs_update?(css_file, template_file)
    end
    def exact_stylesheet_needs_update?(css_file, template_file)
      if !File.exists?(css_file)
        return true
      else
        css_mtime = File.mtime(css_file)
        File.mtime(template_file) > css_mtime ||
          dependencies(template_file).any?(&dependency_updated?(css_mtime))
      end
    end
  end

  # At some point Sass::Plugin changed from using the metaclass to extend self.
  metaclass = class << self; self; end
  if metaclass.included_modules.include?(Sass::Plugin)
    if method(:stylesheet_needs_update?).arity == 2
      alias exact_stylesheet_needs_update? stylesheet_needs_update?
    elsif !method_defined?(:exact_stylesheet_needs_update?)
      include StylesheetNeedsUpdate
    end
  else
    class << self
      unless method_defined?(:exact_stylesheet_needs_update?)
        include StylesheetNeedsUpdate
      end
    end
  end

end

Version data entries

15 entries across 14 versions & 2 rubygems

Version Path
compass-0.10.0 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc6 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc5 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc4 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc3 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc2 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.rc1 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre9 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre8 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre7 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre6 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/compass-0.10.0.pre5/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/compass-0.10.0.pre4/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre5 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
compass-0.10.0.pre4 lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb