{"id":20460996,"url":"https://github.com/ericgj/elm-bem","last_synced_at":"2025-06-18T06:39:31.033Z","repository":{"id":159357300,"uuid":"634621843","full_name":"ericgj/elm-bem","owner":"ericgj","description":"Elm utilities for following Block-Element-Modifier conventions in CSS classes","archived":false,"fork":false,"pushed_at":"2023-05-01T00:37:45.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T00:35:26.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","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/ericgj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-30T18:10:17.000Z","updated_at":"2023-04-30T18:11:01.000Z","dependencies_parsed_at":"2023-05-21T13:45:26.776Z","dependency_job_id":null,"html_url":"https://github.com/ericgj/elm-bem","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Felm-bem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Felm-bem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Felm-bem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Felm-bem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericgj","download_url":"https://codeload.github.com/ericgj/elm-bem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242017428,"owners_count":20058426,"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-11-15T12:22:47.444Z","updated_at":"2025-03-05T11:27:28.884Z","avatar_url":"https://github.com/ericgj.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-bem\n\nUtilities for following BEM ([Block-Element-Modifier](https://getbem.com/naming))\nconventions in CSS classes.\n\nThis library builds on work done in \n[renanpvaz/elm-bem](https://package.elm-lang.org/packages/renanpvaz/elm-bem/latest) \nwith a different API.\n\nIt supports both \"flag\" style and \"key-value\" style modifiers on blocks and\nelements.\n\n\n## Example\n\n```elm\nimport Html.Bem as Bem\n\nview : String -\u003e { sticky : Bool, title : String, bodyData : BodyData } -\u003e Html msg\nview blockName model =\n    let\n        block =\n            Bem.init blockName\n\n        headerEl =\n            block.element \"header\"\n\n        bodyEl =\n            block.element \"body\"\n    in\n    div\n        [ block |\u003e Bem.block ]\n        [ header\n            [ headerEl |\u003e Bem.elementIf \"sticky\" model.sticky ]  \n            [ h1 [] [ text model.title ] ]\n        , div\n            [ bodyEl |\u003e Bem.elementOf \"type\" model.bodyData.bodyType ]\n            [ viewBody block model.bodyData ]\n        ]\n\nviewBody : Bem.Block -\u003e BodyData -\u003e Html msg\nviewBody block bodyData =\n    -- render sub-elements tied to the top-level Bem.Block\n\n```\n\nThen calling \n\n```elm\nview \n    \"thing\" \n    { sticky: True, title: \"Thing\", bodyData = { bodyType = \"article\", ... } }\n```\n\nresults in\n\n```html\n\u003cdiv class=\"thing\"\u003e\n    \u003cheader class=\"thing__header thing__header--sticky\"\u003e\n        \u003ch1\u003eThing\u003c/h1\u003e\n    \u003c/header\u003e\n    \u003cdiv class=\"thing__body thing__body--type-article\"\u003e\n        ...\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\n## Installing\n\nInstall in the root of your project\n\n```shell\n$ elm install ericgj/elm-bem\n```\n\nand import in your modules like\n\n```elm\nimport Html.Bem\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericgj%2Felm-bem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericgj%2Felm-bem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericgj%2Felm-bem/lists"}