I have a maven project with folders like myproject/src/main/resources/public. I am using this maven project just to make a war and deploy my UI code (containing HTML5, JavaScript(with jQuery), CSS etc) to tomcat server and nothing java related.
And inside public folder, I have index.html and builder.js files defined.
index.html which has the following line:
<button type="button" id = "bButton " onclick="location.href='https://myserver-dev.com/Builder/builder.html'">Builder</button>
And another JS file builder.js where I am setting env variable like this:
// var envURL = "http://localhost:8080";
var envURL = "https://myserver-dev.com";
//var envURL = "https://myserver-test.com";
I was thinking of creating a separate JS file, maybe something like properties.js or env.js and put the following in it so that I can just import it in html and js files whenever needed:
// var envURL = "http://localhost:8080";
var envURL = "https://myserver-dev.com";
//var envURL = "https://myserver-test.com";
If I do that what would be the best way to get the envURL inside index.html and builder.js at appropriate places?