Open Riduidel opened 10 years ago
Do you mean logging a message when the resource controller and the webjar controller (these two controllers are serving respectively the assets and the webjar resources) can't find the requested assets ?
To do this, no need for a watcher.
On 30/06/2014 19:01, Clement Escoffier wrote:
Do you mean logging a message when the resource controller and the webjar controller (these two controllers are serving respectively the assets and the webjar resources) can't find the requested assets ?
No. Well .... when thinking about it, it may be a yes. Let me rephrase it.
My issue was that I was writing an HTML page using angular.js script. And, dumb as I am, I was unable to locate it. So i tried libs/angular/angular.js and other paths, but none resulted into what I wanted. So I tried to see that issue fro the developper stand point, and told to myself "well, if I was in Eclipse, i would have an error marker for that". Which immediatly sent me into the watcher direction :
what I want is that, when I save an HTML page, contained links are (, , and even and ) are analyzed, and each missing target is displayed in an error message, with possible replacements alongside.
This led me into the Watcher direction. Unfortunatly, as you wrote
Unfortunately, because of the dynamics of Wisdom Framework, you cannot retrieve / compute the route at package time
So I guess logging bad resources paths in the resource and webjar controller would be a good start. But onluy a start, as it requires me to modify my HTML file, then go into my browser to reload it.
Nicolas Delsaux
Oh I see !
Actually, it might be possible if you are only looking for self-contained application (an application containing all its assets). In that case you can check / deduce what are the available assets and generate a pipeline error is something is missing.
Just for information, in #13 we have extended the route
object injected in template to compute the url of assets as follows:
<link th:href="${#routes.asset('css/bootstrap.min.css')}" rel="stylesheet"/>
<link th:href="${#routes.asset('/css/bootstrap-theme.min.css')}" rel="stylesheet"/>
<script th:src="${#routes.asset('/jquery.js')}"></script>
<script th:src="${#routes.asset('js/bootstrap.min.js')}"></script>
If Wisdom is not able to compute one of these urls, a page explaining the error is displayed (see image)
On 02/07/2014 09:26, Clement Escoffier wrote:
Just for information, in #13 https://github.com/wisdom-framework/wisdom/issues/13 we have extended the |route| object injected in template to compute the url of assets as follows:
|
If Wisdom is not able to compute one of these urls, a page explaining the error is displayed (see image)
org_thymeleaf_exceptions_templateprocessingexception_cannot_find_the_url_of_the_asset_js_bootstrap_min_js-missing__bundleentry___56_fwk394714818_templates_samples_samples_thl_html29 https://cloud.githubusercontent.com/assets/402301/3452785/24e290a8-01ba-11e4-8b5a-7a0a2a55ab8a.png
This means one should never use direct link, but rather always use that route resolution ... which, as far as I know, isn't documented :-) Yeah, i've just checked in main documentation, the "#routes.asset(...)" expression can't be found. Which obviously idnicates it's an easter egg, where it's precisely the kind of things that would make that link checker useless (provided it can be enforced ... which is another question).
Nicolas Delsaux
I've implemented this feature last night (despite the low issue number). Documentation is coming, just be patient ;-)
On 2 juil. 2014, at 14:09, Nicolas Delsaux notifications@github.com wrote:
On 02/07/2014 09:26, Clement Escoffier wrote:
Just for information, in #13 https://github.com/wisdom-framework/wisdom/issues/13 we have extended the |route| object injected in template to compute the url of assets as follows:
|<link th:href="${#routes.asset('css/bootstrap.min.css')}" rel="stylesheet"/> <link th:href="${#routes.asset('/css/bootstrap-theme.min.css')}" rel="stylesheet"/>
If Wisdom is not able to compute one of these urls, a page explaining the error is displayed (see image)
org_thymeleaf_exceptions_templateprocessingexception_cannot_find_the_url_of_the_asset_js_bootstrap_min_js-missing__bundleentry___56_fwk394714818_templates_samples_samples_thl_html29 < https://cloud.githubusercontent.com/assets/402301/3452785/24e290a8-01ba-11e4-8b5a-7a0a2a55ab8a.png
This means one should never use direct link, but rather always use that route resolution ... which, as far as I know, isn't documented :-) Yeah, i've just checked in main documentation, the "#routes.asset(...)" expression can't be found. Which obviously idnicates it's an easter egg, where it's precisely the kind of things that would make that link checker useless (provided it can be enforced ... which is another question).
Nicolas Delsaux
— Reply to this email directly or view it on GitHub https://github.com/wisdom-framework/wisdom/issues/247#issuecomment-47767878 .
I've made some documentation (in the master branch).
When updating an HTML file, it would be of great help to have wisdom identify missing ressources, be them scripts or images.
Typically, I would like to have
wisdom:run
show me the missing assets in the console. Ideally, that error message would use data provided by #245 to show available ressources (or a subset of them if possible).I guess it could be possible to do it using a wisdom
Watcher
, no ? (don't yet know how to do it, however)