Skip to content

Try absolute path for Propshaft assets#8402

Merged
aduth merged 2 commits intomainfrom
aduth-propshaft-abs-path
May 16, 2023
Merged

Try absolute path for Propshaft assets#8402
aduth merged 2 commits intomainfrom
aduth-propshaft-abs-path

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented May 16, 2023

🛠 Summary of changes

Changes url(...) to reference assets using absolute (slash-prefixed) paths, in hopes of fixing issues observed in deployed environments, and following related migration guidance:

[...]Propshaft assumes all paths are relative to the path of the file it’s processing. Since it was processing a css file inside the theme folder, it will also look for hero.jpg in the same folder.

By adding a / at the start of the path we are telling Propshaft to consider this path as an absolute path.

https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft

📜 Testing Plan

  1. Go to http://localhost:3000
  2. Observe ⬇️ caret image next to "Here's how you know in banner"

@aduth
Copy link
Contributor Author

aduth commented May 16, 2023

Works locally and in my personal sandbox, 🤞 for other deployed environments.

@aduth aduth merged commit 8a97e26 into main May 16, 2023
@aduth aduth deleted the aduth-propshaft-abs-path branch May 16, 2023 18:46
aduth added a commit that referenced this pull request May 17, 2023
aduth added a commit that referenced this pull request May 17, 2023
* Revert "Fix handling for missing SP logo (#8409)"

This reverts commit e3da0a7.

* Revert "Try absolute path for Propshaft assets (#8402)"

This reverts commit 8a97e26.

* Revert "Replace Sprockets with Propshaft (#8387)"

This reverts commit c8d8a38.

* Keep spec improvements from e3da0a7

* Keep spec improvements from c8d8a38

* Keep webpack digest suffix from c8d8a38
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.

3 participants