Class: Yescode::Assets
- Inherits:
-
Object
- Object
- Yescode::Assets
- Defined in:
- lib/yescode/assets.rb
Instance Method Summary collapse
- #compile_assets ⇒ Object
- #css(filenames = []) ⇒ Object
-
#initialize ⇒ Assets
constructor
A new instance of Assets.
- #js(filenames = []) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Assets
Returns a new instance of Assets.
5 6 7 8 |
# File 'lib/yescode/assets.rb', line 5 def initialize @assets_path = File.join(".", "app") @assets = Hash.new { |hash, key| hash[key] = [] } end |
Instance Method Details
#compile_assets ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/yescode/assets.rb', line 18 def compile_assets css = AssetCompiler.compile(@assets, "css") unless @assets["css"].empty? js = AssetCompiler.compile(@assets, "js") unless @assets["js"].empty? @assets["css"] = [css] @assets["js"] = [js] end |
#css(filenames = []) ⇒ Object
10 11 12 |
# File 'lib/yescode/assets.rb', line 10 def css(filenames = []) @assets["css"] = filenames end |
#js(filenames = []) ⇒ Object
14 15 16 |
# File 'lib/yescode/assets.rb', line 14 def js(filenames = []) @assets["js"] = filenames end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/yescode/assets.rb', line 26 def to_h @assets end |