{"id":22994873,"url":"https://github.com/scriptype/bem","last_synced_at":"2025-03-01T10:16:22.508Z","repository":{"id":57217608,"uuid":"42895056","full_name":"scriptype/bem","owner":"scriptype","description":"A small utility for creating dynamic BEM classnames.","archived":false,"fork":false,"pushed_at":"2015-09-21T22:03:09.000Z","size":92,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T07:36:31.627Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scriptype.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-21T21:37:58.000Z","updated_at":"2023-09-04T23:45:37.000Z","dependencies_parsed_at":"2022-08-28T21:00:41.530Z","dependency_job_id":null,"html_url":"https://github.com/scriptype/bem","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptype%2Fbem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptype%2Fbem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptype%2Fbem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptype%2Fbem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptype","download_url":"https://codeload.github.com/scriptype/bem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241348357,"owners_count":19948164,"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-12-15T05:27:39.992Z","updated_at":"2025-03-01T10:16:22.486Z","avatar_url":"https://github.com/scriptype.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bem\n\nA small utility for creating dynamic BEM classnames.\n\n### Install\n`npm i dynamic-bem-classnames`\n\n### Usage\n\n`var bem = require('bem');`\n\nor\n\n`define(['path/to/bem'], function...)`\n\nor\n\n`\u003cscript type='text/javascript' src='path/to/bem.min.js'\u003e\u003c/script\u003e`\n\nthen\n\n```js\nvar itemClasses = bem.makeClassName({\n  block: 'foo-list',\n  element: 'item',\n  modifiers: {\n    active: function (blockName, element, modifiers) {\n      return true // logic\n    },\n    hidden: true // hardcode\n  }\n})\n\n// \"foo-list__item foo-list__item--active foo-list__item--hidden\"\n```\n\n`block` is mandatory to at least have a base class string.\n`element` and `modifiers` options are optional.\n`modifiers` is an object accepting multiple modifier conditions.\n\n### Customize\n\nYou don't have to use default delimiters for elements and modifiers:\n\n```js\nbem.setDelimiters({\n  modifier: '__'\n  element: '⛄',\n})\n\n// bem.makeClass(...)\n```\n\n### Development\n\nI've preferred to use ES6 syntax and APIs in the source code. This means, we\nneed babel to transpile it. And uglify for uglify.\n\n - `npm i -g babel`\n - `npm i -g uglify`\n - `npm run build`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptype%2Fbem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptype%2Fbem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptype%2Fbem/lists"}