1.0.0 • Published 8 years ago

babel-plugin-version-transform v1.0.0

Weekly downloads
19
License
MIT
Repository
github
Last release
8 years ago

babel-plugin-version-transform

Replaces keyword VERSION with a stringified copy of the package.json version number.

Example

In

version: "1.0.0"
function log(data) {
  xhr({...data, version: VERSION});
}

Out

version: "1.0.0"
function log(data) {
  xhr({...data, version: "1.0.0"});
}

Installation

$ npm install babel-plugin-transform-define

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [
    "version-transform"
  ]
}

Via CLI

$ babel --plugins version-transform script.js

Via Node API

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