https://github.com/ramasilveyra/unreact
Convert React Components to EJS or Pug [Alpha][Unreleased]
https://github.com/ramasilveyra/unreact
ejs pug react
Last synced: about 1 month ago
JSON representation
Convert React Components to EJS or Pug [Alpha][Unreleased]
- Host: GitHub
- URL: https://github.com/ramasilveyra/unreact
- Owner: ramasilveyra
- License: mit
- Created: 2018-05-29T09:09:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-10T05:40:30.000Z (over 6 years ago)
- Last Synced: 2025-03-30T03:03:47.965Z (2 months ago)
- Topics: ejs, pug, react
- Language: JavaScript
- Homepage:
- Size: 259 KB
- Stars: 14
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Convert React Components to EJS or Pug (unreact)
The future is React without React.Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Limitations](#limitations)
- [Future](#future)
- [Contribute](#contribute)
- [License](#license)Install
**Node.js v8 or newer** is required.
Via the yarn client:
```bash
$ yarn add --dev unreact
```Via the npm client:
```bash
$ npm install --save-dev unreact
```Usage
### Convert Files (`--out-file`/`-o`)
```bash
unreact src/button.js --out-file views/button.pug
```### Convert Directories (`--out-dir`/`-O`)
```bash
unreact src --out-dir views
```### Template Engine (`--template-engine`/`-t`)
Default option is `pug`, you can also choose `ejs`.
```bash
unreact src/button.js --out-file views/button.ejs --template-engine ejs
unreact src --out-dir views -t ejs
```### Add string to the beginning of the output file (`--add-beginning`)
```bash
unreact src/main.js --out-file views/main.pug --add-beginning "include header.pug"
```### Add string to the ending of the output file (`--add-ending`)
```bash
unreact src/main.js --out-file views/main.pug --add-ending "include footer.pug"
```### Change initial indent level (`--initial-indent-level`)
```bash
unreact src/main.js --out-file views/main.pug --initial-indent-level 1
```Limitations
**ALPHA: things may not work**
- Only works with functional components and very simple ones.
Future
Check the work bridging React and Prepack:
- https://github.com/facebook/prepack/pulls?utf8=%E2%9C%93&q=is%3Apr+react
- https://twitter.com/trueadm/status/1002812303824314369
- https://github.com/trueadm/ssr-with-prepack-hackathonContribute
Feel free to dive in! [Open an issue](https://github.com/ramasilveyra/unreact/issues/new) or submit PRs.
unreact follows the [Contributor Covenant](https://contributor-covenant.org/version/1/4/) Code of Conduct.
License
[MIT](LICENSE.md)