1.0.0 • Published 7 years ago

babel-plugin-transform-jsx-html v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Transforms JSX to HTML

Using this simple Babel plugin you can use JSX syntax to write inline HTML templates for Vue components. The plugin searches for JSX parent elements and if an callee name is t replaces callee and JSX with the same JSX but in a string.

Usage

{
  "presets": ["es2015"],
  "plugins": ["transform-jsx-html"]
}

Example

The plugin transforms the following code:

Vue.component( 'component', {
	template: t(
		<div>
			<input type='checkbox' v-model='show' />
			<pre v-if='show' >Hello!</pre>
		</div>
	)
} );

to the following code:

Vue.component( 'component', {
	template: '<div><input type=\'checkbox\' v-model=\'show\' /><pre v-if=\'show\'>Hello!</pre></div>'
} );