Class: Yescode::Assets

Inherits:
Object
  • Object
show all
Defined in:
lib/yescode/assets.rb

Instance Method Summary collapse

Constructor Details

#initializeAssets

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_assetsObject



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_hObject



26
27
28
# File 'lib/yescode/assets.rb', line 26

def to_h
  @assets
end