babel-plugin-html-attributes-to-jsx

1.6.22 • Public • Published

babel-plugin-html-attributes-to-jsx

Coerce HTML attributes into something JSX and React friendly. Used by MDX.

Installation

yarn add babel-plugin-html-attributes-to-jsx

Usage

const babel = require('@babel/core')

const plugin = require('babel-plugin-html-attributes-to-jsx')

const jsx = `
export const Foo = () => (
  <div srcset="foo">
    <Button />
  </div>
)
`

const plugin = new BabelPluginHtmlAttributesToJsx()

const result = babel.transform(jsx, {
  configFile: false,
  plugins: ['@babel/plugin-syntax-jsx', plugin]
})

console.log(result.code)

Input

export const Foo = () => (
  <div srcset="foo">
    <Button />
  </div>
)

Output

const Foo = () => (
  <div srcSet="foo">
    <Button />
  </div>
)

License

MIT

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i babel-plugin-html-attributes-to-jsx

    Homepage

    mdxjs.com

    Weekly Downloads

    43

    Version

    1.6.22

    License

    MIT

    Unpacked Size

    18 kB

    Total Files

    5

    Last publish

    Collaborators

    • remcohaszing
    • johno
    • timneutkens
    • wooorm