Skip to content

Output languages

Ross Morsali edited this page May 22, 2022 · 4 revisions

There are 2 officially supported output languages, and the ability to create custom languages:

Note Handlebars is provided as a "catch all", an option that can be used in many scenarios. But it is recommended to build straight to your server side language if possible, to improve rendering performance and reduce dependencies on your server side application.

Setting the language

This should be done in your babel configuration and is as simple as passing a language property to initialisation:

Handlebars

The default langauge is Handlebars so no configuration is required:

plugins: [ 
	[ 'babel-plugin-jsx-template-vars' ],
],

Or you could supply the language name handlebars:

plugins: [ 
	[ 'babel-plugin-jsx-template-vars', { language: 'handlebars' } ],
],

PHP

Set the language to php.

plugins: [ 
	[ 'babel-plugin-jsx-template-vars', { language: 'php' } ],
],
Clone this wiki locally