@zong/js.macro
v1.0.2
Published
Macro in JavaScript powered by Babel.
Downloads
3
Readme
js.macro
Macro in JavaScript powered by Babel.
This is an experimental project, do not use in production.
Install
yarn add @zong/js.macroBefore use
Adding the plugin to your config
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["macros"]
}Use
define
Base
import { define } from '@zong/js.macro'
define`
@a:1;
@b:2;
@c:'cde';
@d:"def";
@e:true;
@f:false;
`// Compiled
const a = 1;
const b = 2;
const c = "cde";
const d = "def";
const e = true;
const f = false;Advanced
import { define } from '@zong/js.macro'
const var1 = 2
define`
@va:${1};
@vb:${var1};
`// Compiled
const var1 = 2;
const va = 1;
const vb = var1;