babel-plugin-transform-jsx-html

1.0.0 • Public • Published

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>'
} );

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.05latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.05

Package Sidebar

Install

npm i babel-plugin-transform-jsx-html

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • khc