babel-plugin-transform-simple-e4x

1.2.2 • Public • Published

babel-plugin-transform-simple-e4x

Version Build Status Codacy Badge codecov

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 git@github.com: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

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-transform-simple-e4x

Weekly Downloads

0

Version

1.2.2

License

MIT

Unpacked Size

45 kB

Total Files

6

Last publish

Collaborators

  • pikamachu