Class: MerbDynamicSass::Stylesheets

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/stylesheets.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_cache?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/controllers/stylesheets.rb', line 16

def self.page_cache?
  Merb::Slices.config[:merb_dynamic_sass][:page_cache]
end

Instance Method Details

#index(path) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/stylesheets.rb', line 25

def index(path)
  @template_path = path
  if self.slice.action_cache_store.exists?(_cache_path)

    m_template = File.mtime _location_of_template
    m_cache = File.mtime _location_of_cache

    if m_template > m_cache
      self.slice.action_cache_store.delete _cache_path
    end

  end

  self.content_type = :css
  self.slice.action_cache_store.fetch _cache_path do
    sass = render(:format => :css)
    Sass::Engine.new(sass).to_css
  end
end