babel-plugin-inline-json-import
Inlines JSON file imports straight into JS code
Last updated 2 years ago by yggie .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install babel-plugin-inline-json-import 
SYNC missed versions from official npm registry.

babel-plugin-inline-json-import

NPM

Build Status

A babel pre-processor that inlines all imports of JSON files straight into your JavaScript files.

Example

Given the following JSON file:

{
  "foo": "bar"
}

The plugin will transform the following statement:

import json from './path/to/file.json';

or

to:

const json = { foo: "bar" };

Simple as that! Both require and import are supported.

Installation

Install the plugin through npm, you will also need babel installed for obvious reasons:

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

Add babel-plugin-inline-json-import to the list of plugins. If you are using a .babelrc file, the file should have an entry that looks like this:

{
  "plugins": [
    ["inline-json-import", {}]
  ]
}

Usage

This should work straight out of the box without any configuration.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request =)

License

This project is licensed under the MIT License - see the LICENSE file for details

Current Tags

  • 0.3.2                                ...           latest (2 years ago)

12 Versions

  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 2
This Week 7
This Month 33
Last Day 0
Last Week 13
Last Month 28
Dependencies (1)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |