Introduction
What does it do?
The extension provides a full rendering environment for Handlebars templates within TYPO3 CMS. All core features of Handlebars.js are supported by the usage of the third-party library PHP Handlebars.
Its main use is to seamlessly integrate Handlebars templates into TYPO3 without the need to modify these templates again for output in TYPO3. This makes it a good fit for projects whose templates are developed in a frontend component library such as Fractal or Storybook.
How does it work?
Rendering is configured in TypoScript, in the same way as with
FLUIDTEMPLATE
:
- A HANDLEBARSTEMPLATE content object defines which template to render, e.g. for a content element.
- Its
variablesanddataconfiguration prepare the data passed to the template, using TYPO3's content objects and data processors.Processing - The template name is resolved to a
.hbsfile within the configured template paths. - The template is compiled (and cached), rendered with the prepared variables and returned as output.
Extbase plugins can render Handlebars templates as well, see Extbase plugins.
Features
- Templating engine: Full Handlebars rendering environment for TYPO3
- TypoScript integration:
HANDLEBARSTEMPLATEcontent object and additional data processors to prepare template variables - Component libraries: Fractal-compatible template names (
@name,@name--)variant - Layouts: Layout inheritance with
extend,blockandcontenthelpers - Custom helpers: Custom helpers with auto-registration via PHP attributes
- Extbase support: Controller-based rendering via
HandlebarsView - Caching: Integration with TYPO3's cache framework for compiled templates
- Extensibility: PSR-14 events and replaceable services for all parts of the rendering pipeline
- Compatibility: Compatible with TYPO3 13.4 LTS and 14.3 LTS
Support
There are several ways to get support for this extension:
Security Policy
Please read our security policy if you discover a security vulnerability in this extension.
License
This extension is licensed under GNU General Public License 2.0 (or later).