Skip to content
forked from thysultan/jsx.js

small and extendable jsx transpiler

License

Notifications You must be signed in to change notification settings

streamich/jsx.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsx.js

a light and extendable jsx compiler.

  • ~3kb minified
  • ~1.5kb minified + gzipped

API

jsx(
	str, {string}
	extend: {(Object<string, function>|string)}
);

This method recieves a string and optional extend object/string that is used to create a custom mapping for the javascript output, for example...

jsx(str, {
	text: function (children) {
	 	// return string
	},
	element: function (type, props, children) {
	 	// return string
	},
	component: function (type, props, children) {
		// return string
	}
	props: function (props, node) {
		// return string
	}
	node: function (node) {
		// return string
	}
});

jsx(str, 'React.createElement');

If the input string has a pragma comment, for example/* @jsx h */ it will use that for the output mapping, if no pragma comment/custom mapping has been specicifed it defaults to hyperscript h(...).

About

small and extendable jsx transpiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 89.8%
  • HTML 10.2%