Skip to content

bem/bem-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,709 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bem-core library CI GitHub Release

Documentation on bem-core is also available at bem.info. It is also available in Russian.

What is this?

bem-core is a base library for web interface development. It provides the minimal stack for coding client-side JavaScript and templating.

Use

Install as an npm dependency:

npm install bem-core@5

jQuery 4 is a peer dependency — install it alongside:

npm install jquery@^4.0.0

Inside

Levels

  • common.blocks — suited for any devices and browsers
  • desktop.blocks — should be used for desktop browsers
  • touch.blocks — implement some touch-platforms specifics

Blocks

  • i-bem — base block with helpers for JS and HTML
  • strings — helpers for JS-strings
  • objects — helpers for JS-objects
  • functions — helpers for JS-functions
  • events — JS-events
  • uri — helpers for work with URIs and querystrings
  • tick — global timer
  • idle — IDLE event
  • next-tick — polyfill for nextTick/setTimeout(0, ...)
  • inherit — OOP helpers
  • jquery — jQuery
  • clearfix — CSS clearfix trick
  • identify — identify JS-objects
  • cookie — helpers for work with browser cookies
  • dom — helpers for work with DOM
  • loader — loader for JS files
  • ua — browser features detection
  • keyboard — keyboard helpers
  • page — html/head/body scaffold

Technologies

  • vanilla.js + browser.js
  • bemhtml
  • bemtree

API

The autogenerated JSDoc API can be found on bem.info. E.g. JSDoc for i-bem is here https://en.bem.info/platform/libs/bem-core/current/desktop/i-bem/#jsdoc

Changelog

See CHANGELOG.md.

Migration

If you are upgrading from v4, see MIGRATION.md.

Development

Working copy

  1. Get the source code:

    git clone -b v5 git://github.com/bem/bem-core.git
    cd bem-core
  2. Install the dependencies (requires Node.js 20+):

    npm install
  3. Run linting:

    npm run lint
  4. Run tests:

    npm test              # server-side tests (node:test)
    npm run test:browser  # browser tests (Playwright)
    npm run test:all      # both
  5. Build:

    npm run build         # desktop + touch platforms

How to contribute

Please refer to How to contribute guide.

Supported browsers

  • Google Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

Code and documentation copyright 2012 YANDEX LLC. Code released under the Mozilla Public License 2.0.

Packages

 
 
 

Contributors

Languages