-
Couldn't load subscription status.
- Fork 14
Using other static assets #14
Description
Thank you for building npm-pipeline-rails. I have been using it and it is a really good solution to easily integrate npm scripts (webpack in our case) with the rails asset pipeline. 👍
Processing CSS and JavaScript works perfectly!
At the moment I got stuck with image assets.
Theoretically, all static assets could be placed into the public folder. However, there are some images and svgs wich run through webpack to be optimised or concatenated.
And for caching-reasons, I do not want to inline images and svgs into the JavaScript bundle but rather use them as single files.
The problem with this approach is, that due to the asset pipeline's fingerprinting the files cannot be accessed without using a rails helper.
💡 My ideas so far:
- moving all assets to the public directory
- this works good for static assets that don't change or don't need to be processed
rake assets:precompilecreates a.sprockets-manifest-*.jsonfile which maps the filenames- There is no rails-helper available, so I don't know the filename in my JS and I actually don't want to load the manifest json
- The fingerprint is good for dealing with the cache
Is there a good way to deal with assets, especially images and svgs? Can the fingerprint be obtained somehow in a good way?
I would like to know whether someone else did run into the same problem and whether there are some approaches to solve that problem. 🤔
Thanks!