Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/developit/jsxobj
- Owner: developit
- License: mit
- Created: 2016-08-27T17:14:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-25T01:37:57.000Z (almost 3 years ago)
- Last Synced: 2024-12-16T10:23:31.379Z (9 days ago)
- Topics: blood-magic, json, jsx
- Language: JavaScript
- Homepage: https://jsfiddle.net/developit/frvec8jb/
- Size: 11.7 KB
- Stars: 220
- Watchers: 4
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - jsxobj
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"
}
}
}
```