Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developit/jsxobj

Build JSON using JSX 🌈 (may contain blood magic)
https://github.com/developit/jsxobj

blood-magic json jsx

Last synced: 1 day ago
JSON representation

Build JSON using JSX 🌈 (may contain blood magic)

Awesome Lists containing this project

README

        

# `jsxobj` [![NPM](https://img.shields.io/npm/v/jsxobj.svg?style=flat)](https://www.npmjs.org/package/jsxobj) [![travis-ci](https://travis-ci.org/developit/jsxobj.svg?branch=master)](https://travis-ci.org/developit/jsxobj)

Converts JSX to Objects (JSON) using blood magic.

```sh
npm install --save jsxobj
```

---

### Example

```js
import jsxobj from 'jsxobj';

// example of an import'd plugin
const CustomPlugin = config => ({
...config,
name: 'custom-plugin'
});

console.log(











);
```

The above outputs:

```json
{
"name": "webpack",
"target": "web",
"watch": true,
"entry": {
"path": "src/index.js"
},
"resolve": {
"alias": {
"from": "react-dom",
"to": "preact-compat"
}
},
"plugins": {
"uglify-js": {
"opts": {
"compression": true,
"mangle": false
}
},
"custom-plugin": {
"foo": "bar"
}
}
}
```