
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
bem-generator
Advanced tools
Utility for working with BEM convention (works better with React)
npm i --save bem-generator
// App.js
import React from 'react'
import { render } from 'react-dom'
import { block } from 'bem-generator'
const App = () => {
let header = block('header')
let nav = block('nav')
let link = nav.element('link')
let footer = block('footer')
return (
<div>
<header className={ header } >
<h1 className={ header.element('title') }>My App</h1>
</header>
<nav className={ nav }>
<ul>
<li className={ link.modifier('active') }>Home</li>
<li className={ link }>About</li>
</ul>
</nav>
<footer className={ footer }>
<p className={ footer.element('copy') }>Copyright</p>
</footer>
</div>
)
}
render(<App />, document.body)
You can create a element and give it a block:
import { block, element } from 'bem-generator'
let b = block('foo')
let el = element('bar', b)
el.toString()
// -> 'foo__bar'
el.modifier('red').toString()
// -> 'foo__bar foo__bar--red'
Modifiers accepts more than one modifier:
import { block, element } from 'bem-generator'
let b = block('foo')
el.modifier(['large', 'red']).toString()
// -> 'foo foo--large foo--red'
MIT
FAQs
Generate BEM class names with ease
We found that bem-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.