generic-jsx-transpiler

0.9.9 • Public • Published

generic-jsx-transpiler npm version Build Status

A library for transpiling JSX for use without React. Has no dependencies.

Checkout the webpack loader

Setup

npm install generic-jsx-transpiler --save-dev

Usage

Here is a bare bones example of API usage. Proper usage examples can be found in the examples directory.

node examples/hyperscript to run Hyperscript example

const Parser = require('generic-jsx-transpiler').Parser;

const testJsx = `const ele = <div/>`

// This will simply output '<div/>' in place of any JSX blocks
function serialize(parsedComponent){
  return `<div/>`;
};

// Our "serializer" just needs to have a 'serialize' function
const serializer = { serialize };

const parser = new Parser({ serializer });

const transpiledSource = parser.parse({
  source: "",
  // inputPath: "", // source param will override this
  // async: false, // Will return promise if true
});

console.log(transpiledSource);

API

Coming soon

Package Sidebar

Install

npm i generic-jsx-transpiler

Weekly Downloads

3

Version

0.9.9

License

ISC

Unpacked Size

33.3 kB

Total Files

11

Last publish

Collaborators

  • outstream