babel-plugin-convert-to-json

Convert various file formats to json on import

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-convert-to-json
330.1.06 years ago6 years agoMinified + gzip package size for babel-plugin-convert-to-json in KB

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