Modify the the produced html

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify the the produced html

paranoiabla
Hello,

in my company we work on different projects with Thymeleaf and we have designers who come on a later stage of the project in order to make the website sexy. They usually play around with the css and the html structure and the most common question I get asked is "Where is this html snippet coming from?". The what I usually do is try to look it up in which .html file it resides and because we sometimes have lots of imported fragments and snippets it is time consuming to find it.
So i thought to myself - wouldn't it be nice if there was a special property and when this property is set at the end of every html fragment I'd see in a comment the name of the view that produced this html snippet. Something like this:

<div>
    some div content here.
    <! -- it comes from myproduct.html -->
</div>

How can this be achieved with thymeleaf?
Reply | Threaded
Open this post in threaded view
|

Re: Modify the the produced html

Zemi
Administrator
Hi Paranoiabla,

adding that HTML to the fragment itself would do the trick.

If you don't want it to appear on production you can make it conditional depending on some global variable, or simply run an HTML minimizer on production.

Regards,
  Zemi
Reply | Threaded
Open this post in threaded view
|

Re: Modify the the produced html

paranoiabla
Hi Zemi,

of course adding that information in the snippet would do the trick but I don't want to go through all the 250 .html files and add it. I was asking if there's a way to extend Thymeleaf in such a way that it would happen automatically - perhaps by adding an IPostProcessor or something else.