Class: EmberCli::Assets::AssetMap

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

Instance Method Summary collapse

Constructor Details

#initialize(name:, asset_map:, index_html:) ⇒ AssetMap

Returns a new instance of AssetMap.



7
8
9
10
11
# File 'lib/ember_cli/assets/asset_map.rb', line 7

def initialize(name:, asset_map:, index_html:)
  @name = name
  @asset_map = asset_map
  @index_html = index_html
end

Instance Method Details

#javascriptsObject



13
14
15
16
17
18
19
20
# File 'lib/ember_cli/assets/asset_map.rb', line 13

def javascripts
  assert_asset_map!

  Nokogiri::HTML(index_html.read).css('script').map {|s|
    filename = File.basename(s['src'])
    asset_matching(/#{Regexp.escape(filename)}\z/)
  }
end

#stylesheetsObject



22
23
24
25
26
27
28
29
# File 'lib/ember_cli/assets/asset_map.rb', line 22

def stylesheets
  assert_asset_map!

  Nokogiri::HTML(index_html.read).css('link[rel="stylesheet"]').map {|s|
    filename = File.basename(s['href'])
    asset_matching(/#{Regexp.escape(filename)}\z/)
  }
end