Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bluewings/pug-as-jsx-utils

utils for pug-as-jsx
https://github.com/bluewings/pug-as-jsx-utils

Last synced: about 2 months ago
JSON representation

utils for pug-as-jsx

Awesome Lists containing this project

README

        

# pug-as-jsx-utils

```js
const { pugToJsx } = require('pug-as-jsx-utils');

const result = pugToJsx(`
div
h1.greeting(onClick='{handleClick}')
| Hello World, {name}!
`, { template: true });
```

```js
// result
{
"jsx": "

\n

\n Hello World, {name}!\n

\n
",
"imports": [],
"useThis": false,
"variables": [
"handleClick",
"name"
],
"jsxTemplate": "import React from 'react';\n\nexport default function(__params = {}) {\n const { handleClick, name } = __params;\n return (\n
\n

\n Hello World, {name}!\n

\n
\n);\n}\n"
}

// result.jsx



Hello World, {name}!


// result.jsxTemplate
import React from 'react';

export default function(__params = {}) {
const { handleClick, name } = __params;
return (



Hello World, {name}!



);
}
```