Reputation: 10291
I use Vaadin @JavaScript annotation to load JavaScript files for my application. It works great but I would need different JavaScript loaded for differents builds. The idea is to have something like these:
@JavaScript("url.from.properties.or.pom")
So for DEV I would get @JavaScript("https://example.com/test/js/embed.js") and for PROD @JavaScript("https://example.com/production/js/embed.js"). The script url value should be taken from application.properties or pom.xml.
I cannot figure out how to do it. I use Vaadin 8 with Maven and Spring Boot. Thank you in advance.
Upvotes: 2
Views: 60
Reputation: 8001
There's no direct support for what you want to do, but I can come up with three different solutions that you could consider.
DependencyFilter
that dynamically rewrites the dependency URL from the annotation depending on the situation.@JavaScript
annotation and instead call JavaScript.eval
from onAttach
to somehow dynamically inject the script you want.Upvotes: 3