diff --git a/CHANGELOG.md b/CHANGELOG.md
index d61347b..3f4454c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+main
+------
+
+* Emit the scripts and stylesheets that `index.html` points outside the build (a CDN, a font service) as they are, instead of failing to resolve them against the build output
+* Ignore `}.html_safe }.
inject(&:+)
end
+ # `prepend` mounts the build's assets onto a path (or another host), so it only applies to the URLs that point into the build.
+ # Assets hosted elsewhere (a CDN, a font service) are already absolute.
+ def mount_asset(src, prepend)
+ if EmberCli::Assets::Url.remote?(src)
+ src
+ else
+ [prepend, src].join
+ end
+ end
+
# Vite builds boot from ES modules declared in dist/index.html, so extract
# the tags required for startup (including the config meta tag and
# stylesheets) and remap root-absolute paths onto the mount point.
diff --git a/lib/ember_cli/assets/asset_map.rb b/lib/ember_cli/assets/asset_map.rb
index 1b21187..e83c665 100644
--- a/lib/ember_cli/assets/asset_map.rb
+++ b/lib/ember_cli/assets/asset_map.rb
@@ -1,5 +1,6 @@
require 'nokogiri'
require "ember_cli/assets/errors"
+require "ember_cli/assets/url"
module EmberCli
module Assets
@@ -13,25 +14,35 @@ def initialize(name:, asset_map:, index_html:)
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/)
- }
+ document.css('script').filter_map { |script| asset_for(script['src']) }
end
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/)
- }
+ document.css('link[rel="stylesheet"]').filter_map { |link| asset_for(link['href']) }
end
private
attr_reader :name, :asset_map, :index_html
+ def document
+ @document ||= Nokogiri::HTML(index_html.read)
+ end
+
+ # Assets hosted outside the build (a CDN, a font service) have no entry in the asset map, so their URL is emitted untouched.
+ # A tag without a URL (an inline `
+
+
+
+