Closed edwardEx closed 5 years ago
Yes, you can put your dynamically recompiled assets in /public/bundle for example, and use assets("/bundle/**")
in jooby to server this files (mvn jooby:run). you dont have to restart jooby to serve the updated bundles.
Hi, in addition to Andrew's comment. It is possible to use file system for your assets. See
{ assets("/static/**", Paths.get("/www")); }
So that serves files from file system (not jar).
Template engines (in a way or another) offers a cache which by default is OFF. This give you modify/change/reload support. The cache is off is you start your application in non-dev mode (setting application.env system property) Beside this is enabled by default you need to configure your Template Engine to use a file-system template loader. This is very specific to the template engine (thymeleaf, handlebars, etc). The default and portable template loader is always a classpath base, this is way you can't edit template.
thymeleaf example:
{
use(new Thl().doWith(engine -> {
FileTemplateResolver resolve = ...;
engine.setTemplateResolver(resolver);
engine.setCacheable(false);
}));
}
As you see it is very specific to template engine. This is more or less documented in the advance section of the module: https://jooby.org/doc/thymeleaf/#thymeleaf-advanced-configuration
First of all, thank you very much guys for your answer. As time passed I thought I might not get a response =P
Second, I'm gonna try and get back to you as soon as I can. Specially with Edgar's answer about the thymeleaf part which looks very promising for what I want.
If that works, it's gonna make the deployment a lot faster cause that way I won't have to re-compile Jooby each time I change something in Angular for the front-end.
I gotta say I actually wrote a shell script so I could do all in one go: 1- compile Angular project and copy to jooby public folder 2- search and replace into a config file I have in Angular to change it's base path so it works in the jooby context 3- compile Jooby with the new html and js from Angular 4- connect and deploy to server 5- kill app and restart
I guess it's not the most elegant way to do it right? =P but...I was in a hurry at work and couldn't find another way
Soooo, thank you very much,
I will try the Thymeleaf part, and reply with my results :)
cool, sorry for my late response (been busy with 2.x)... for quick responses is probably better to ask in the channel: https://gitter.im/jooby-project/jooby
Hello, Idk if this is the right place to ask. I'm new to github. I believe this might be the most direct way to ask. =P
1- I'm loving jooby, feels more quick and flexible than springboot. it has a short learning curve which is nice.
2- MY QUESTION: is there a way to have the html (views) as independent files when I compile Jooby? or are they always forced to be compiled within the big fat jar?
-Context of use:
-THE PROBLEM: -I have to change my base paths in Angular specific to match the deployment server -Everytime I want to change something in Angular, I have to compile angular, AND THEN compile jooby again. <--- this is why I want to know if HTML can be independent?
I already tryied creating a "public" . folder where the big fat jar is, and placing the html , but it doesn't seem to work.
I come from PHP, soo, I'm kinda used to change a view, and have the result instantly.
But with java it seems you always have to re-compile, doen't matter if it is jsp or thymeleaf or jooby with angular.
So, is there something in jooby for independent html, so I can change an image, or text, o button, and not have to recompile jooby again?
Thanks in advanced.
does this question belong in stackoverflow? sorry if I posted in wrong place.