babel-plugin-define-function
A plugin for Babel 6 allows you to define dynamic variables at build time with functions.
Installation
$ npm install babel-plugin-define-
.babelrc
Example
Given the following definitions:
var exec = execSyncvar details = var buildNumber = 0 moduleexports = // Define a static version variable. __VERSION__: detailsversion // Evaluate git commit at build time. { // This function will be called on each build. return + '-' + buildNumber++ }
And the following file:
consoleconsole
becomes:
consoleconsole
and on the second build (if watching):
consoleconsole
Contributions
- Use
npm test
to run tests.