leesiongchan / babel-plugin-ramda

Easy :ram: modular builds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel-plugin-ramda Build Status

This plugin is a simple transform to remove unused ramda dependencies, without forcing the user to cherry pick methods manually. This lets you use ramda naturally (aka as documented) without worrying about bundling parts you're not using.

See also babel-plugin-lodash.

Example

Converts

import R, {map} from 'ramda';

map(R.add(1), [1, 2, 3]);

Roughly to

import add from 'ramda/src/add';
import map from 'ramda/src/map';

map(add(1), [1, 2, 3]);

Limitations

  • You must be using ES6 imports (both specifiers and default work) to load ramda.

  • Imports are at top of file (we do the transform in one pass, if they are at the bottom of the file they may be missed)

Usage

Via .babelrc (Recommended)
{
  "plugins": ["ramda"]
}
Via CLI
$ babel --plugins ramda script.js
Via Node API
require("babel-core").transform("code", {
  plugins: ["ramda"]
});

About

Easy :ram: modular builds


Languages

Language:JavaScript 100.0%