Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/bluewings/pug-as-jsx-utils
- Owner: bluewings
- Created: 2018-12-12T04:33:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:23:05.000Z (almost 2 years ago)
- Last Synced: 2024-10-17T13:17:05.585Z (2 months ago)
- Language: JavaScript
- Size: 401 KB
- Stars: 2
- Watchers: 2
- Forks: 5
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
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);\n}\n"\n Hello World, {name}!\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}!
);
}
```