Skip to content
Babel plugin for transpiling JSX and createElement to ESX on the server
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.gitignore
LICENSE 1st Apr 24, 2019
index.js
package.json
readme.md

readme.md

babel-plugin-esx-ssr

Babel plugin for the Server-Side which converts JSX to ESX for performance gains.

Status

Experimental.

Example

In

import React from 'react'

const data = { value: 'hi '}

const Component = ({value}) => (
  <div>
    <p> some content </p>
    <p> some {value} </p>
  </div>
)

const App = () => <Component {...data}/>

export default App

Out

const esx = require('esx')();

import React from 'react';
const data = {
  value: 'hi '
};

const Component = ({
  value
}) => esx`<div>
    <p> some content </p>
    <p> some ${value} </p>
  </div>`;

esx.register({
  Component
});

const App = () => esx`<Component ...${data}/>`;

export default App;

Installation

$ npm install babel-plugin-esx-ssr

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["esx-ssr"]
}

Via CLI

$ babel --plugins esx-ssr script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["esx-ssr"]
});

Requirements

This plugin is for esx v2.x.x.

Contributions

esx is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the CONTRIBUTING.md file for more details.

Licence

MIT

You can’t perform that action at this time.