Replies: 2 comments 1 reply
-
I also would like a way to get the asset_path in javascript. For example, when I want to use customize the icon library for shoelace.style, I can do this: registerIconLibrary("default", { resolver: (name) => `https://cdn.jsdelivr.net/npm/[email protected]/icons/${name}.svg` }) … but I can't refer to local assets and do something like: registerIconLibrary("default", { resolver: (name) => asset_path(`icons/${name}.svg`) }) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've just managed to get something like this working. You can use the new RAILS_ASSET_URL helper from propshaft. To use it do something like this:
which outputs the full finger-printed path: If the path fails to resolve, there will be a log message in the rails server logs. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a servicer worker where I have a list of files to be cached. Previous, I ran using
.erb
extension to get that, like this:Now I decided to move
sw.js
to esbuild build flow but I don't know how can I assetapplication.js
file link there.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions