Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update asset_map to handle assets more than one level deep #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshuabremerdexcom
Copy link

@joshuabremerdexcom joshuabremerdexcom commented Jun 23, 2023

When a CSS files is used in the index.html that has a path like such: /assets/dir1/dir2/dir3/library.css. The asset map throws an exception that it can't be found. This is because the DirectoryAssetMap only looks at children, and not the entire tree. This now returns all the files found recursively for it to check. In addition, it returns the relative path, so there isn't a risk of two files in different directories colliding.

Addresses issue: #24

When a CSS files is used in the `index.html` that has  a path like such: `/assets/dir1/dir2/dir3/library.css`. The asset map throws an exception that it can't be found. This is because the DirectoryAssetMap only looks at children, and not the entire tree. This now returns all the files found recursively for it to check. In addition, it returns the relative path, so there isn't a risk of two files in different directories colliding.
@joshuabremerdexcom
Copy link
Author

joshuabremerdexcom commented Jun 23, 2023

I did go through the contributing guide and ran bin/setup. I couldn't get my full test suite setup, but I didn't get those specific files to pass tests. Any guidance? I can add it to my PR.

 Failure/Error: EmberCli[name].build

     ActionView::Template::Error:
       No `ember-cli` executable found for `my-app`.

       Install it:

           $ cd /Users/jbremer/repos/ember-cli-rails-assets/spec/dummy/my-app
           $ yarn install
           ```
           
           
           ```
           
 ❯ tree spec/dummy/my-app
spec/dummy/my-app
├── node_modules
│   └── ember-cli-rails-addon
│       ├── CHANGELOG.md
│       ├── README.md
│       ├── app
│       │   └── initializers
│       │       └── ember-cli-rails-addon-csrf.js
│       ├── index.js
│       ├── package.json
│       └── tests
│           └── addon-test.js
├── package.json
├── tmp
└── yarn.lock

@Samsinite
Copy link

@joshuabremerdexcom I noticed that this same section has an error if it is a non-local asset (such as google fonts) as well (#25), what if it tries to catch ArgumentError if there is no relative_path_from(directory) and returns the original path if so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants