supreetpal / babel-plugin-boilerplate

A setup to get you started on building babel plugins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read babel plugin handbook -> https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md

Try http://astexplorer.net/#/Pcw9baefXI for a visual understanding.

babel-plugin-boilerplate

Add a description for the plugin here

Example

In

let tips = [
  "Paste or drop some JavaScript here and explore the syntax tree created by chosen parser.",
  "You can use all the cool new features from ES6 and even more. Enjoy!"
];

function printTips() {
  tips.forEach((tip, i) => console.log(`Tip ${i}:` + tip));
}

Out

let spit = ["Paste or drop some JavaScript here and explore the syntax tree created by chosen parser.", "You can use all the cool new features from ES6 and even more. Enjoy!"];

function spiTtnirp() {
  spit.hcaErof((pit, i) => elosnoc.gol(`Tip ${ i }:` + pit));
}

Installation

$ npm install babel-plugin-boilerplate

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["boilerplate"]
}

Via CLI

$ babel --plugins boilerplate script.js

Via Node API

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

About

A setup to get you started on building babel plugins.

License:MIT License


Languages

Language:JavaScript 100.0%