Hi,
Im using Vaadin 12. Structure of my war project is:
appName
src
main
webapp
frontend
styles
img
I style my app layout via src\main\webapp\frontend\styles\shared-styles.html:
<custom-style>
<style>
.page-layout {
background-image: url('../img/bkg.jpg');
}
</style>
</custom-style>
I user relative url for image as it was recommended (https://vaadin.com/docs/v12/flow/importing-dependencies/tutorial-include-css.html).
It works in FF- browser builds valid url “host:port/appName/frontend/img/bkg.jpg” because starts from styles path (host:port/appName/frontend/styles) so “…/” points to “host:port/appName/frontend/”.
But it doesn’t work in Chrome- browser builds invalid url “host:port/img/bkg.jpg” because starts from app path (host:port/appName) so “…/” points to “host:port/”.
When I use normal css file (styles.css, not shared-styles.html) and use “background-image: url(‘frontend/img/bkg.jpg’);” everything is ok (it works in Chrome and FF).
Can anyone help me to solve this problem when using custom-style in html, which seems to be the recommended approach?
Any help is appreciate