# Rexjs
**Repository Path**: mic-pages/Rexjs
## Basic Information
- **Project Name**: Rexjs
- **Description**: Rexjs - 是一款又快、又小、性价比极高的 JavaScript(ES6+) 语法的编译器!
- **Primary Language**: JavaScript
- **License**: MIT
- **Default Branch**: master
- **Homepage**: http://www.rexjs.org
- **GVP Project**: No
## Statistics
- **Stars**: 54
- **Forks**: 10
- **Created**: 2017-01-05
- **Last Updated**: 2022-07-11
## Categories & Tags
**Categories**: javascript-toolkits
**Tags**: None
## README
### Rexjs is a faster and smaller `JavaScript(ES6+)` compiler!
------
#### [中文](https://github.com/china-liji/Rexjs/blob/master/doc/read-me/chinese.md)
#### Link
* [Homepage](https://china-liji.github.io/Rexjs.org)
* [GitHub](https://github.com/china-liji/Rexjs)
#### Install
* NPM
```
npm install rexjs-api
```
* Git
```
git clone https://github.com/china-liji/Rexjs.git
```
* Download
[Zip](https://github.com/china-liji/Rexjs/archive/master.zip)
[rex.min.js](https://raw.githubusercontent.com/china-liji/Rexjs/master/./dist/rex.min.js) - 250KB
[rex-api.min.js](https://raw.githubusercontent.com/china-liji/Rexjs/master/./dist/rex-api.min.js) - 247KB
[rex-browser-helper.min.js](https://raw.githubusercontent.com/china-liji/Rexjs/master/./dist/rex-browser-helper.min.js) - 18KB
-----
#### Faster and Smaller

`./dist/rex.min.js`[1.7.1] only 250KB, smaller than others.
-----
#### Usage
> **Web**
```html
```
cross browser: `Chrome`、`Firefox`、`Safari`、`IE9+`.
> **Nodejs**
* ./ext.js
```js
import path from "path";
export default function(filename){
return path.parse(filename).ext;
};
```
* ./index.js
```js
import ext from "./ext.js";
// output ".js"
ext(__filename);
```
* Command Line
```
rexjs ./index.js
```
> **Rexjs API**
* JavaScript
```js
// import "rexjs-api" module
// Nodejs
let Rexjs = require("rexjs-api");
// Web Worker
importScripts("./dist/rex-api.min.js");
let Rexjs = self.Rexjs;
// Web:
let Rexjs = window.Rexjs;
// initialize parser
let es5Code = "", parser = new Rexjs.ECMAScriptParser();
// parse module from a file
parser.parse(
// init file
new Rexjs.File(
// filename
"./filename.js",
// source
"class Car {}"
)
);
// returning the generated code
es5Code = parser.build();
```
* HTML
This file provides generated code API, so reference it before run generated code in your browser.
```html
```
-----
#### Other Packages
* [Rexjs-loader](https://github.com/china-liji/Rexjs-loader) - Webpack Loader.
* [Rexjs-template](https://github.com/china-liji/Rexjs-template) - A data binding HTML template compiler.
-----
Thanks!