-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Freemarker #66
Comments
Added a wiki page (with a link to the initial ticket) regarding template languages in Muban: For Freemarker, I see 2 JS libraries: And 2 webpack loaders: All of them are using/calling Java under the hood, which makes it impossible for me to add any logic around the template files (e.g. partial comments, presets, including script/style tags in the templates). Even if I could get it to work, the muban setup would be slimmed down and configured slightly different, but it could still be beneficial to these kinds of projects. What are the exact benefits you are trying to gain for this implementation? Would you be able to send me a few FM templates / partials so I can have a quick look to see if I can get anything to work? |
The biggest benefit would be development speed. Working in Liferay template themes is extremely slow. You need to build and deploy the theme in order to see the changes. This can take up to several minutes. |
Okay, so far I learned the following:
Looking at some example Liferay template files, they contain a lot of Liferay logic:
And some custom code that probably is provided as Java things:
These things make it impossible to use the templates as-is in your project (and visa-versa), so this implementation would only provide the full FTL support, and data through tdd (json) files. |
Currently, this is the best I could do ( In the brach, use the following new commands:
It uses a similar setup as in the Hot reloading doesn't work yet, but CSS updates do a behind-the scene refresh, and others will still reload the page within a second, so you get the same speed and effortless development environment. The FTL pages are rendered with the exact same setup as the handlebars templates (in build mode), and use the exact same data (the page yaml with imports to blocks, etc). They are outputted in the same folder als the normal HTMLs, but with the Any shared data/utils/etc can be I had to use the following freemarker constructs to get the setup working nicely: Block rendering, with assign alias for easier data access:Assign: muban/src/app/component/layout/app/app.ftl Lines 11 to 12 in d86597b
Use:
Turn on auto-escaping in each HTML file, and use
|
<#ftl output_format="HTML"> |
Raw:
<p>${data.content?no_esc}</p> |
Make macros for partials to pass information as props:
Macro
muban/src/app/component/general/button/button.ftl
Lines 1 to 5 in d86597b
<#ftl output_format="HTML"> | |
<#macro button text> | |
<button data-component="button">${text}</button> | |
</#macro> |
Import:
<#include "/general/button/button.ftl"> |
Use:
<@button text="${data.ctaReadMore}"/> |
It would be great if Muban could support other template languages, like Freemarker. We are currently using Muban for a Liferay project. Liferay uses Freemarker as template engine. If we would be able to use Freemarker in Muban it would be easier to use the templates in Liferay.
The text was updated successfully, but these errors were encountered: