babel-plugin-convert-to-json
v0.1.0
Published
Convert various file formats to json on import
Downloads
1,242
Maintainers
Readme
babel-plugin-convert-to-json
Convert various file formats to json on import. Very much so a work in progress, currently supports .yml
and .env
files
Example
In
import yml from './yml.yml'
import env from './.env'
Out
const yml = <JSON>
const env = <JSON>
Installation
$ npm install babel-plugin-convert-to-json
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["convert-to-json"]
}
Via CLI
$ babel --plugins convert-to-json script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["convert-to-json"]
});