ultraq / thymeleafjs

A basic implementation of the Thymeleaf templating engine in JavaScript
Apache License 2.0
52 stars 8 forks source link

Template loader for webpack #16

Closed ultraq closed 6 years ago

ultraq commented 6 years ago

The way I've currently got template fragments working in the thymeleafjs-todo project is a rather roundabout hack: because I can't parse HTML templates for Thymeleaf fragments, I've set the example consuming app to read all templates to a special templates alias in the webpack configuration, matching a templates require directing when trying to load the necessary template.

What I really need is a Webpack loader that knows how to read Thymeleaf templates, and so can pick out HTML templates that it needs and so includes them in the final bundle.

ultraq commented 6 years ago

Related: coming up with various "template resolvers", a concept in core Thymeleaf for being able to pull templates from any source. A similar thing will need to be done here. Maybe that solution will supersede the need for special loaders for the various bundlers out there too.

So template resolvers for bundles, node servers, across networks, etc, will need to be developed.

ultraq commented 6 years ago

This special loader won't be needed any more since devs can now decide how to include and load templates. In the todo example app, templates are included in the bundle via a templates alias, but I'm thinking of even making the resolution function a requirement.