Find the assets nested in the build output - #45
Merged
Merged
Conversation
The asset map is built from `dist/assets`, but it only listed that directory's own children, so a file an addon ships in a subdirectory was represented by the subdirectory itself. A document referencing one, such as `<link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css">`, therefore failed with `Failed to find assets matching`. Walk the whole tree and key every file by its path within the directory. Resolving a reference now matches on the longest trailing path that `index.html` and the asset map agree on, so a nested asset resolves to the file it names rather than to whichever file happens to share its basename. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tricknotes
commented
Sep 18, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
tricknotes
marked this pull request as ready for review
September 18, 2026 01:07
Merged
tricknotes
pushed a commit
to tricknotes/ember-cli-rails
that referenced
this pull request
Sep 18, 2026
`ember build` writes what an addon ships in a subdirectory of `assets` into that subdirectory, and `index.html` refers to it by that path. Listing the `assets` directory one level deep represented such a file by the subdirectory that holds it, and matching a reference by its file name alone resolved it to whichever file happened to share that name. Represent every file by its path within `assets`, and resolve a reference by the longest trailing path the document and the build output agree on. A reference that carries the `assets` directory, or the application's `rootURL`, still resolves. This carries what the asset helpers gained in tricknotes/ember-cli-rails-assets#45 into the code that now interprets the build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24.
The asset map is built from
dist/assets, but it only listed that directory's own children, so a file an addon ships in a subdirectory was represented by the subdirectory itself.A document referencing one, such as
<link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css">, therefore failed withFailed to find assets matching.Changes
dist/assetstree inEmberCli::Assets::DirectoryAssetMap, keying every file by its path within the directory (font-awesome/css/font-awesome.min.css) instead of listing only the top levelEmberCli::Assets::AssetMapby the longest trailing path thatindex.htmland the asset map agree on, rather than by file name alone. A nested asset then resolves to the file it names rather than to whichever file happens to share its basename, and a reference carrying the build'srootURLstill resolvesVerification
spec/libandspec/helperspass (20 examples).Of the four new examples, the one covering the nested listing and the one covering a basename shared across directories fail without the change; the other two cover references that already resolved and guard the new matching.
The
spec/featuressuite, which builds a real Ember application, was not run here.