{"id":17771211,"url":"https://github.com/azproduction/b_","last_synced_at":"2025-04-08T04:19:09.217Z","repository":{"id":24158708,"uuid":"27548656","full_name":"azproduction/b_","owner":"azproduction","description":"BEM class name formatter","archived":false,"fork":false,"pushed_at":"2017-09-16T20:00:26.000Z","size":18,"stargazers_count":102,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:37:08.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azproduction.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-04T16:17:02.000Z","updated_at":"2024-12-05T10:50:01.000Z","dependencies_parsed_at":"2022-08-26T09:52:38.234Z","dependency_job_id":null,"html_url":"https://github.com/azproduction/b_","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azproduction%2Fb_","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azproduction%2Fb_/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azproduction%2Fb_/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azproduction%2Fb_/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azproduction","download_url":"https://codeload.github.com/azproduction/b_/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773726,"owners_count":20993639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T21:30:26.440Z","updated_at":"2025-04-08T04:19:09.194Z","avatar_url":"https://github.com/azproduction.png","language":"JavaScript","readme":"# b_\n\n[![NPM Version](https://badge.fury.io/js/b_.png)](https://npmjs.org/package/b_)\n[![Build Status](https://travis-ci.org/azproduction/b_.png?branch=master)](https://travis-ci.org/azproduction/b_)\n\nBEM class name formatter\n\n## Example\n\n### Simple\n\n```js\nvar b = require('b_');\n\n// blocks\nb('button', {size: 'xl'}) === 'button button_size_xl';\n\n// block elements\nb('modal', 'close', {size: 'xl'}) === 'modal__close modal__close_size_xl';\n\n// boolean modifiers\nb('button', {hidden: false}) === 'button';\nb('button', {hidden: true}) === 'button button_hidden';\n```\n\n### Alternative BEM syntax\n\n```js\nvar B = require('b_').B;\nvar b = B({\n    tailSpace: ' ',\n    elementSeparator: '-',\n    modSeparator: '--',\n    modValueSeparator: '-',\n    classSeparator: ' '\n});\n\nb('block', 'elem', {mod1: true, mod2: false, mod3: 'mod3'}) ===\n'block-elem block-elem--mod1 block-elem--mod3-mod3 ';\n```\n\n### [BEViS](https://github.com/bevis-ui/docs) syntax\n\n```js\nvar B = require('b_').B;\nvar b = B({isFullModifier: false});\n\nb('button_call-for-action', {disabled: true, focused: 'yes'}) ===\n'button_call-for-action _disabled _focused_yes';\n```\n\n### Full bool values in modifiers\n\n```js\nvar B = require('b_').B;\nvar b = B({isFullBoolValue: true});\n\nb('button', {disabled: true, focused: false}) ===\n'button button_disabled_true button_focused_false';\n```\n\n### React example\n\n```jsx\nvar b = require('b_').with('b-button');\n// or\nvar b = require('b_').lock('b-button');\n// which is `require('b_').bind(null, 'b-button');` but much convenient\n\nfunction render() {\n    return (\n        \u003cdiv className={b()}\u003e\n            \u003cspan className={b('icon', {type: 'add'})}\u003e\u003c/span\u003e\n            \u003cspan className={b('text')}\u003e\u003c/span\u003e\n        \u003c/div\u003e\n        \u003cdiv className={b({size: 'small'})}\u003e\n            \u003cspan className={b('icon', {type: 'add'})}\u003e\u003c/span\u003e\n            \u003cspan className={b('text')}\u003e\u003c/span\u003e\n        \u003c/div\u003e\n    );\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazproduction%2Fb_","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazproduction%2Fb_","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazproduction%2Fb_/lists"}