-
Hi, I would like to have directory structure as shown on https://vite-ruby.netlify.app/guide/development.html#entrypoints-%E2%A4%B5%EF%B8%8F But when I use How can I use images outside of entrypoints directory? I tried to create symlink from app/frontend/images to app/frontend/entrypoints/images as a workaround but Zeitwek had problems with that. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 11 replies
-
Edit: The following is outdated, see #108 (comment) instead. Hi Aleš, Any asset that will be referenced using tag helpers such as This is only necessary when images are referenced directly in server-rendered HTML. Otherwise images can be placed in any directory when:
|
Beta Was this translation helpful? Give feedback.
-
@AlesLulak In 3.0.0 it's now possible to reference files outside the
|
Beta Was this translation helpful? Give feedback.
-
Hey @ElMassimo, do you think it's worth adding an extra tag helper for something like -- image_pack_path("example.jpg", class: "example")`
++ image_tag(vite_asset_path("images/example.jpg"), class: "example")` It's a really minor thing, but it might make a few people's lives a bit easier when upgrading/switching 🤷♂️ PS: |
Beta Was this translation helpful? Give feedback.
-
Hi @ElMassimo I am using |
Beta Was this translation helpful? Give feedback.
-
@ElMassimo , could you please provide a concrete working example for how to get images working from the I have tried a lot of different things, but can't seem to get it to work unless I move the images into the vite.json {
"all": {
"sourceCodeDir": "app/javascript",
"additionalEntryPoints": [
"assets/images/**/*"
]
},
"development": {
"autoBuild": true,
"publicOutputDir": "vite-dev",
"port": 3036
},
"test": {
"autoBuild": true,
"publicOutputDir": "vite-test",
"port": 3037
}
}
(have tried with or without Image tags
(not working) Direct import
(not working, unless using a resolve alias) Any suggestions would be appreciated! |
Beta Was this translation helpful? Give feedback.
@AlesLulak In 3.0.0 it's now possible to reference files outside the
entrypoints
dir.vite_asset_path 'images/logo.svg'
now works out of the box in the example structure.