Class: Deadfire::AssetLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/deadfire/asset_loader.rb

Overview

AssetLoader is responsible for loading mixin templates from the file system which can be used to mixin css into your stylesheet.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ AssetLoader

Returns a new instance of AssetLoader.



9
10
11
12
# File 'lib/deadfire/asset_loader.rb', line 9

def initialize(path)
  @path = path
  @cache = ActiveSupport::Cache::FileStore.new("tmp/deadfire_cache")
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



7
8
9
# File 'lib/deadfire/asset_loader.rb', line 7

def settings
  @settings
end

Instance Method Details

#cache_css(name, value) ⇒ Object



14
15
16
# File 'lib/deadfire/asset_loader.rb', line 14

def cache_css(name, value)
  cached_mixins[name] = value
end

#cached_css(name) ⇒ Object



18
19
20
# File 'lib/deadfire/asset_loader.rb', line 18

def cached_css(name)
  cached_mixins[name]
end

#preload(force_reload = false) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/deadfire/asset_loader.rb', line 22

def preload(force_reload=false)
  if force_reload
    @_cached_mixins = nil
  end

  cached_mixins
end