babel-plugin-inline-json
[![Build Status](https://travis-ci.org/gkatsev/babel-plugin-inline-json.svg?branch=master)](https://travis-ci.org/gkatsev/babel-plugin-inline-json)
Last updated 3 years ago by gkatsev .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-inline-json 
SYNC missed versions from official npm registry.

babel-plugin-inline-json

Build Status

Inline values from a JSON file eg. a config file

Does not work if the argument to require() is an identifier or a template literal

Example

config.json:

{
  "foo": "bar"
}

In

var foo = require('config').foo;

Out

var foo = "bar";

Installation

$ npm install babel-plugin-inline-json --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [["inline-json", {"matchPattern": "config"}]]
}

Via CLI

$ babel --plugins inline-json script.js

Via Node API

require("babel-core").transform("code", {
  "plugins": [["inline-json", {"matchPattern": "config"}]]
});

Origin

this is based on @mwilliams-change's babel-plugin-inline-json-config-values.

Current Tags

  • 1.2.2                                ...           latest (3 years ago)

6 Versions

  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 14
This Month 37
Last Day 1
Last Week 2
Last Month 38
Dependencies (2)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |