Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ramasilveyra/unreact

Repository files navigation

Convert React Components to EJS or Pug (unreact)

The future is React without React.

EJS and Pug templates engines can be between 1647% and 7083% faster than ReactDOMServer.renderToString (React 15) .

Table of Contents

Install

Node.js v8 or newer is required.

Via the yarn client:

$ yarn add --dev unreact

Via the npm client:

$ npm install --save-dev unreact

Usage

Convert Files (--out-file/-o)

unreact src/button.js --out-file views/button.pug

Convert Directories (--out-dir/-O)

unreact src --out-dir views

Template Engine (--template-engine/-t)

Default option is pug, you can also choose ejs.

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)

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)

unreact src/main.js --out-file views/main.pug --add-ending "include footer.pug"

Change initial indent level (--initial-indent-level)

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:

Contribute

Feel free to dive in! Open an issue or submit PRs.

unreact follows the Contributor Covenant Code of Conduct.

License

MIT

About

Convert React Components to EJS or Pug [Alpha][Unreleased]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /