Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@shelf/bem
Advanced tools
Readme
Slim version of bem-cn without mixins, state and other stuff.
$ yarn add @shelf/bem
import {block} from '@shelf/bem';
const b = block('nav-item');
function NavLink({isActive, href, icon, name}) {
return (
<li className={b({active: isActive})}> // .nav-item .nav-item--active
<Icon icon={icon} className={b('icon')} /> // .nav-item__icon
<a href={href} className={b('link')}> // .nav-item__link
{name}
</a>
</li>
);
}
You can pass either element or modifiers as a first argument. Modifies can be passed as an array or object.
import {block} from '@shelf/bem';
const b = block('nav-item');
b(); // nav-item
b('link'); // nav-item__link
b(['active']); // nav-item nav-item--active
b({active: true}); // nav-item nav-item--active
Second argument is modifiers & could be combined with element. You can pass them as an array or object.
const isActive = true;
b('link', [isActive && 'active']); // nav-item__link nav-item__link--active
const isSelected = true;
b('link', {selecter: isSelected}); // nav-item__link nav-item__link--selected
You can setup your own delimiters for element and modifier
import {setup} from '@shelf/bem';
const block = setup({el: '_', mod: '-'});
const b = block('nav-item');
b('link'); // nav-item_link
b('link', ['active']); // nav-item_link nav-item_link-active
Additionally you can pass ns
to customize namespace
const block = setup({ns: 'my-app-'});
const b = block('nav-item');
b(); // my-app-nav-item
You can also provide custom classMap to map your class names to bem class names. Helpful when you want to use bem with css modules.
import {setup} from '@shelf/bem';
const block = setup({classMap: {'nav-item__link': 'nav-item__link-13'}});
const b = block('nav-item');
b('link'); // nav-item__link-13
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
MIT © Shelf
FAQs
Wrapper around BEM for CSS
The npm package @shelf/bem receives a total of 1,429 weekly downloads. As such, @shelf/bem popularity was classified as popular.
We found that @shelf/bem demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 58 open source maintainers 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.