Marco36
(Marco Zanon)
July 11, 2019, 10:26pm
1
Hi,
my main view is something like:
@Route(value = "")
@Theme(value = Lumo.class)
@HtmlImport("frontend://styles/style.html")
@StyleSheet("frontend://styles/style.css")
@SuppressWarnings("serial")
public class AViewHost extends Div implements ErrorHandler, PageConfigurator {
while style.html contains:
<custom-style>
<style>
body { /* FIXME */
background-color: red !important;
}
</style>
</custom-style>
style.css is loaded and parsed properly.
style.html is loaded properly if you point the browser to localhost:8081/frontend/html/style.html, but Vaadin14 seems to ignore it.
Any help? I tried to read https://github.com/vaadin/vaadin-themable-mixin but had no luck.
Thanks,
MZ
ollit.1
(Olli Tietäväinen)
July 12, 2019, 8:10am
2
If you’re using not using Compatibility mode (aka Bower mode), @HtmlImport
s are ignored; you should use @JsModule
and JavaScript modules instead. Read more here: https://vaadin.com/docs/v14/flow/v14-migration/v14-migration-guide.html
Marco36
(Marco Zanon)
July 12, 2019, 8:47am
3
Olli, thank you so much for pointing me to the right direction.
Is there any reason for JS modules to be put in a frontend/
directory under the project’s root instead of src/main/webapp/frontend/
? This looks quite inconsistent.
Thanks again,
MZ
Denis48
(Denis Anisimov)
July 12, 2019, 9:48am
4
src/main/webapp/frontend/
is a web folder.
frontend/
is not available anyhow in the resulting web application as resources.
Everything is bundled using webpack into one file. So no any single js module is loaded from anywhere.
Marco36
(Marco Zanon)
July 12, 2019, 8:40pm
5
Thanks Denis, I can see the point in what you say.
(Still, I would have used src/main/frontend/
, as js modules are source code too…
Thank you so much,
MZ
Marco36
(Marco Zanon)
July 12, 2019, 9:14pm
6
Olli and Denis, thanks again: your posts helped me to reach the goal.
MZ