babel-plugin-transform-simple-e4x
Introduction
Babel plugin for e4x xml processing.
Usage
npm install\babel-plugin-transform-simple-e4x\babel-preset-env\--save-dev
In your .babelrc
:
The plugin transpiles the following E4X code:
const fooId = 'foo-id';const barText = 'bar text';let xml = ({barText});xml += ;
To the following JavaScript:
var XML = "simple4x";var fooId = 'foo-id';var barText = 'bar text';var xml = "<xml><foo id=\"" + fooId + "\">" + barText + "</foo></xml>";xml;
See tests for more examples and details.
Examples
Web Rendering
Web Service
Requirements
- Babel 7 compatible
Developing
Built with
Folder structure
- root: Contains the README.md, the main configuration to execute the project such as package.json or any other configuration files.
- lib: Contains the source code for plugin.
- test: Contains library tests and examples.
- examples: Contains library examples.
- node_modules: Contains third party JS libraries used in this project
Setting up Dev
Download the code
git clone git@github.com:pikamachu/pika-babel-plugin-transform-simple-e4x.gitcd pika-babel-plugin-transform-simple-e4x
Install dependencies
bash pika install
Run application tests.
bash pika test