babel-plugin-transform-simple-e4x
v1.2.2
Published
Babel plugin for transform obsolete E4X xml processing
Downloads
14
Readme
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
:
{
"presets": ["@babel/preset-env"],
"plugins": ["babel-plugin-transform-simple-e4x"]
}
The plugin transpiles the following E4X code:
const fooId = 'foo-id';
const barText = 'bar text';
let xml = (
<xml>
<foo id={fooId}>{barText}</foo>
</xml>
);
xml += <var id="var-id"/>;
To the following JavaScript:
var XML = new require("simple4x");
var fooId = 'foo-id';
var barText = 'bar text';
var xml = new XML("<xml><foo id=\"" + (fooId) + "\">" + (barText) + "</foo></xml>");
xml.appendChild(new XML("<var id=\"var-id\" />"));
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 [email protected]:pikamachu/pika-babel-plugin-transform-simple-e4x.git
cd pika-babel-plugin-transform-simple-e4x
Install dependencies
bash pika install
Run application tests.
bash pika test