But the downside is, if you blinked your eyes, some previous simple things, are different now. Adding images into your views can be such thing. It’s actually not much harder than the previously used
First, assuming you use Sjabloon, store your images in “frontend/images” (or a sub-directory). Then in your view:
All images in this directory (and subsequent subdirectories) are loaded by these lines in the “frontend/packs/application.js”
const images = require.context('../images', true) const imagePath = (name) => images(name, true)
And that’s it really. The problem most stumble upon is missing to prepend their path with “media” (which is necessary since Webpacker 4).
A Rails SaaS starter kit to build successful products
30+ developers, companies and freelancers bought Sjabloon in the last 4 weeks