Skip to content

developit/jsxobj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

jsxobj NPM travis-ci

Converts JSX to Objects (JSON) using blood magic.

npm install --save jsxobj

Example

import jsxobj from 'jsxobj';

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

console.log(
	<webpack target="web" watch>
		<entry path="src/index.js" />
		<resolve>
			<alias from="react" to="preact-compat" />
			<alias from="react-dom" to="preact-compat" />
		</resolve>
		<plugins>
			<uglify-js opts={{
				compression: true,
				mangle: false
			}} />
			<CustomPlugin foo="bar" />
		</plugins>
	</webpack>
);

The above outputs:

{
  "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"
    }
  }
}

About

Build JSON using JSX ๐ŸŒˆ (may contain blood magic)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published