You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently discovered there's a little bit of work required to support serving "document" assets such as PDFs via Shakapacker that allows nested file paths - effectively the config ended up being:
This is actually the exact configuration Shakapacker uses internally except they have a different test which is static - the key thing is the filename part.
Say we have a file at app/frontend/documents/forms/declaration_form.pdf:
without filename we'd have to do asset_pack_path("declaration_form.pdf") and we'd get something like packs/123abc.pdf
with filename we are able to do asset_pack_path("documents/forms/declaration_form.pdf") and we'd get something like packs/static/documents/forms/declaration_form-123abc.pdf
We don't use these kind of assets in most apps, but it feels easy enough to at least have this documented or included as a code comment in our default webpack config to save people some time.
The text was updated successfully, but these errors were encountered:
Discussed at Ruby Guild on 3 November 2023 and needs more exploration. One concern raised was that it may become mostly unused in most of our apps and adds some complexity to our webpacker setup.
One step is to explore removing sprockets. Ticket to be created for that.
I recently discovered there's a little bit of work required to support serving "document" assets such as PDFs via Shakapacker that allows nested file paths - effectively the config ended up being:
This is actually the exact configuration Shakapacker uses internally except they have a different
test
which is static - the key thing is thefilename
part.Say we have a file at
app/frontend/documents/forms/declaration_form.pdf
:filename
we'd have to doasset_pack_path("declaration_form.pdf")
and we'd get something likepacks/123abc.pdf
filename
we are able to doasset_pack_path("documents/forms/declaration_form.pdf")
and we'd get something likepacks/static/documents/forms/declaration_form-123abc.pdf
We don't use these kind of assets in most apps, but it feels easy enough to at least have this documented or included as a code comment in our default webpack config to save people some time.
The text was updated successfully, but these errors were encountered: