Class: EmberCli::Assets::Paths

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Paths

Returns a new instance of Paths.



6
7
8
# File 'lib/ember_cli/assets/paths.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#asset_mapObject



14
15
16
# File 'lib/ember_cli/assets/paths.rb', line 14

def asset_map
  Pathname.glob(assets.join("assetMap*.json")).first
end

#assetsObject



10
11
12
# File 'lib/ember_cli/assets/paths.rb', line 10

def assets
  app.dist_path.join("assets")
end

#index_htmlObject



22
23
24
# File 'lib/ember_cli/assets/paths.rb', line 22

def index_html
  app.dist_path.join("index.html")
end

#package_jsonObject



18
19
20
# File 'lib/ember_cli/assets/paths.rb', line 18

def package_json
  app.root_path.join("package.json")
end

#vite?Boolean

Vite builds (ember-cli >= 6.8) boot from ES modules in index.html, while classic builds emit plain script tags.

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/ember_cli/assets/paths.rb', line 28

def vite?
  index_html.exist? &&
    !Nokogiri::HTML5(index_html.read).at_css('script[type="module"]').nil?
end