Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.
/ rebem-jsx Public archive

🔣 Babel plugin for reBEM jsx transformations

License

Notifications You must be signed in to change notification settings

rebem/rebem-jsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-transform-rebem-jsx

npm travis deps

Babel plugin allowing you to use JSX with reBEM.

Install

$ npm i -S babel-plugin-transform-rebem-jsx

.babelrc

// without options
{
  "plugins": ["transform-rebem-jsx"]
}
// with options
{
  "plugins": [
    ["transform-rebem-jsx", {
      "externalHelper": false // default is true
    }]
  ]
}

Usage

BEM

import { BEM } from 'rebem';

<BEM tag="span" />
<BEM block="beep" />
<BEM block="beep" elem="boop" />
<BEM block="beep" mods={{ foo: 'bar' }} />
<BEM block="beep" mix={{ block: 'boop' }} />
<span></span>
<div class="beep"></div>
<div class="beep__boop"></div>
<div class="beep beep_foo_bar"></div>
<div class="beep boop"></div>

blockFactory

import { blockFactory } from 'rebem';

// since it's a custom element it should be capitalized
const Block = blockFactory('beep');

<Block />
<Block elem="boop" />
<Block mods={{ foo: 'bar' }} />
<Block mix={{ block: 'boop' }} />
<div class="beep"></div>
<div class="beep__boop"></div>
<div class="beep beep_foo_bar"></div>
<div class="beep boop"></div>

TODO

  • docs
  • move tasks to start-runner
  • actual tests

About

🔣 Babel plugin for reBEM jsx transformations

Resources

License

Stars

Watchers

Forks

Packages

No packages published