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

Asset URLs in JavaScript files #48

Closed
tobyaherbert opened this issue Oct 30, 2021 · 4 comments
Closed

Asset URLs in JavaScript files #48

tobyaherbert opened this issue Oct 30, 2021 · 4 comments

Comments

@tobyaherbert
Copy link

Hey!

I'm using Vue.js in a project and I can't figure out how to reference image files managed by the asset pipeline in the templates. Is there a recommended way to do this?

I understand that the bundling phase occurs before the asset pipeline does anything, so is there anything like a special URL I can put in the template which the asset pipeline rewrites later?

I've also encountered this issue with cssbundling-rails and wondered if a similar solution might be available?

Thanks!

@dhh
Copy link
Member

dhh commented Nov 5, 2021

The CSS issue is handled via Sprockets via rails/sprockets-rails#476 (and Propshaft).

We need separate JS package that can read the digest output of Sprockets (and Propshaft) and give you the URL back. It's just a JSON file.

@tobyaherbert
Copy link
Author

Ah, right. I'll take a look at that CSS PR.

Thanks!

@dhh
Copy link
Member

dhh commented Nov 11, 2021

sprockets-rails 3.3.0 will translate url() calls in regular css to asset digested versions: https://github.com/rails/sprockets-rails/releases/tag/v3.3.0

@dhh
Copy link
Member

dhh commented Dec 14, 2021

We'll tackle this issue in Sprockets and Propshaft.

@dhh dhh closed this as completed Dec 14, 2021
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

No branches or pull requests

2 participants