Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thysultan/jsx.js
small and extendable jsx transpiler
https://github.com/thysultan/jsx.js
jsx transpiler
Last synced: 22 days ago
JSON representation
small and extendable jsx transpiler
- Host: GitHub
- URL: https://github.com/thysultan/jsx.js
- Owner: thysultan
- License: mit
- Created: 2016-10-27T07:26:25.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-20T14:33:23.000Z (almost 6 years ago)
- Last Synced: 2024-04-13T21:13:53.940Z (7 months ago)
- Topics: jsx, transpiler
- Language: JavaScript
- Homepage:
- Size: 44.9 KB
- Stars: 20
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jsx.js
a light and extendable jsx compiler.
- ~3kb minified
- ~1.5kb minified + gzipped## API
```javascript
jsx(
str, {string}
extend: {(Object|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...```javascript
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(...)`.