Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewimm/babel-plugin-inline-package-json
Babel plugin for inlining references to package.json values
https://github.com/andrewimm/babel-plugin-inline-package-json
Last synced: 3 months ago
JSON representation
Babel plugin for inlining references to package.json values
- Host: GitHub
- URL: https://github.com/andrewimm/babel-plugin-inline-package-json
- Owner: andrewimm
- Created: 2015-09-28T18:23:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-29T16:50:47.000Z (almost 8 years ago)
- Last Synced: 2024-07-09T09:47:47.307Z (4 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-inline-package-json
Babel plugin for inlining values from `package.json`
Input:
```js
var version = require('./package.json').version;
```
Output:
```js
var version = '1.0.0';
```The plugin can be used to import any value from a `package.json` file: primitives, objects, or arrays will all be injected into your compiled source as literal expressions.
## Installation
```sh
$ npm install babel-plugin-inline-package-json
```## Usage
### Via `.babelrc`
```json
{
"plugins": ["inline-package-json"]
}
```### Via CLI
```sh
$ babel --plugins inline-package-json script.js
```### Via Node API
```js
require('babel-core').transform('code', {
plugins: ['inline-package-json']
});
```