0.1.0 • Published 7 years ago

babel-plugin-convert-to-json v0.1.0

Weekly downloads
1,327
License
-
Repository
github
Last release
7 years ago

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"]
});