BEM is a hero in frontend world. It brings a system approach in you project and keeps it from the mess. ©
BEM makes your code scalable and reusable, thus increasing productivity and facilitating teamwork. Even if you are the only member of the team, BEM can be useful for you. Nevertheles many developers believe that such a systematic approach like BEM puts additional boundaries on their project and makes your project overloaded, cumbersome and slow.
Is BEM a Hero or a Villain? It's up to you! But first read the article.
Документ описывает, как подключать предсобранные файлы библиотеки bem-react-core с CDN и как работать с библиотекой, не используя сборку.
Чтобы подключить библиотеку bem-react-core, создайде локально HTML-файл и скопируйте следующие ссылки в HTML-код страницы:
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello World</title> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/prop-types/prop-types.min.js"></script> | |
<script src="https://unpkg.com/[email protected]/umd/react.js"></script> | |
</head> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello World</title> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/prop-types/prop-types.min.js"></script> | |
<script src="https://unpkg.com/[email protected]/umd/react.js"></script> | |
</head> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>bem-components as a library</title> | |
</head> | |
<body> | |
<!-- Блок hello для создания формы приветствия --> | |
<form class="hello i-bem" data-bem='{ "hello": {} }'> | |
<div class="hello__greeting">Hello, %user name%!</div> |
```language-diff | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>bem-components as a library</title> | |
+<link rel="stylesheet" href="https://yastatic.net/bem-components/latest/desktop/bem-components.css"> | |
+<script src="https://yastatic.net/bem-components/latest/desktop/bem-components.no-autoinit.js"></script> | |
</head> | |
</html> |
.hello { | |
color: green; | |
padding: 10%; | |
} | |
.hello__greeting { | |
margin-bottom: 12px; | |
} |
module.exports = { | |
block: 'page', | |
title: 'Title of the page', | |
favicon: '/favicon.ico', | |
head: [ | |
{ elem: 'meta', attrs: { name: 'description', content: '' }}, | |
{ elem: 'css', url: 'index.min.css' } | |
], | |
scripts: [{ elem: 'js', url: 'index.min.js' }], | |
content: [ |