Module: Card::Assets
- Defined in:
- mod/assets/lib/card/assets.rb
Overview
Provides methods to refresh script and style assets
Constant Summary collapse
- REFRESHED =
"ASSETS_REFRESHED".freeze
Class Method Summary collapse
-
.active_theme_cards ⇒ Object
-
.inputter_types ⇒ Object
FIXME: if we need this (not sure we do? see below), these types should probably be in a basket so that monkeys can add them.
-
.make_output_coded ⇒ Object
-
.refresh(force: false) ⇒ Object
-
.wipe ⇒ Object
Class Method Details
.active_theme_cards ⇒ Object
43 44 45 46 47 48 |
# File 'mod/assets/lib/card/assets.rb', line 43 def active_theme_cards style_rule = { left: { type: :set }, right: :style } Card.search(referred_to_by: style_rule).select do |theme| theme.respond_to? :theme_name end end |
.inputter_types ⇒ Object
FIXME: if we need this (not sure we do? see below), these types should probably be in a basket so that monkeys can add them.
9 10 11 |
# File 'mod/assets/lib/card/assets.rb', line 9 def inputter_types [JavaScriptID, CoffeeScriptID, CssID, ScssID] end |
.make_output_coded ⇒ Object
39 40 41 |
# File 'mod/assets/lib/card/assets.rb', line 39 def make_output_coded asset_outputters.each(&:make_asset_output_coded) end |
.refresh(force: false) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'mod/assets/lib/card/assets.rb', line 13 def refresh force: false return unless force || refresh? inputters = standard_inputters # typically nonstandard inputters are standard cards, so their events # should manage normal (non-forced) refreshing. # (standard_inputters, by contrast, are in code, so this refreshing is # needed eg in development mode to detect changes) inputters += nonstandard_inputters if force Cache.populate_fields inputters, :asset_input, :asset_output Virtual.cache.read_multi(inputters.map { |i| [i, :asset_input].to_name.key }) inputters.each(&:refresh_asset) generate_asset_output_files if force end |