Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
BEM & Preprocesory (SASS)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tomáš Musiol
April 26, 2014
Technology
400
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
BEM & Preprocesory (SASS)
Přednáška z Ostravského srazu frontendistů. 25.4.2014, Ostrava
Tomáš Musiol
April 26, 2014
Transcript
19 slides
Tomáš Musiol BEM & Preprocesory
B Block Element Modifier E M Co je BEM?
• Konvence pro pojmenování komponent • Nepoužívá ID, popisuje element
výhradně pomocí Class • Střední a velké projekty (Původně Yandex IS) • Odděluje: Block / Element / Modifikátor Co je BEM?
Block (modul): .player
Elementy .player__header .player__cover .player__footer .player__info .player__controls .player__time
Elementy & Modifikátory .player__control .player__control .player__control—share
Výhody • Modulárnost CSS • Znovupoužitelnost kódu • Přehled v
prioritě selektorů (ID vs. Class vs. Zanoření) • Snadnější orientace v GIT repositáři • Snadno pochopitelné pro všechny členy týmu
Nevýhody • Mohou vznikat dlouhé názvy tříd • Zbytečně složité
na malých projektech • Nepořádek v souborech (HTML, CSS), když se nedodržují pravidla
BEM a preprocesory (SASS) .player__info{ ! &__author{ … } &__song{
… } ! } 3.3+
BEM a preprocesory (SASS) .player__info{ ! &__author{ … } &__song{
… } ! } .player__info{ … } .player__info__author{ … } .player__info__song{ … }
BEM a preprocesory (SASS) .player__control{ @extend %control; } ! .player__control--list{
… }
BEM a preprocesory (SASS) .player__control{ @extend %control; } ! .player__control--list{
… } .player__control{ … } .player__control--list{ … }
BEM a preprocesory (SASS) .player__info{ ! .author{ … } .song{
… } ! }
BEM a preprocesory (SASS) .player__info{ ! .author{ … } .song{
… } ! } .player__info{ … } .player__info .author{ … } .player__info .song{ … }
Priorita selektorů BEM Zanořené selektory BEM - modifikátor Zanořené selektory,
modifikátor
Priorita selektorů BEM ID
Struktura souborů a složek
Užitečné pluginy BEM - SublimeText • All Autocomplete • Syntax
highlighting for Sass • SublimeGit • GitGutter
Děkuji za pozornost Tomáš Musiol @kozleek www.musiol.cz
More Decks by Tomáš Musiol
See All by Tomáš Musiol
CEZET Map - Představení projektu
kozleek
1
1.4k
Other Decks in Technology
See All in Technology
AWS Well-Arhitected Frameworkセキュリティの柱 について
miu_crescent
PRO
2
280
Amazon ECS ネットワークモード選びに悩まない ~検証を通じて見えたネットワークモードの選び方~ / 20261114 Masaki Okuda
shift_evolve
PRO
2
170
想定外の利用がプロダクトの価値を広げる
lycorptech_jp
PRO
0
150
Amazon EFS のマルウェアスキャンをClamAV で自前実装したら苦労した話
mtmtfactory01
0
140
VTuberになってみた話
yoshimura_datam
0
140
Welcome JXL!
dynamis
1
1.5k
社内アプリ基盤「Quartz」による、 非エンジニアとAIに本番デプロイを 任せても壊れないプラットフォームの設計
staka121
PRO
1
520
テスト自動化の先、テスト自律化に向けて
mineo_matsuya
4
1.7k
OWASP AI Agentic Top10に準拠するクラウドネイティブなガードレールの実践(CNDW 2026)
keitah
1
460
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
310
Kubernetes, Agones, WebRTC, GPU で作る クラウドゲーミング基盤を本番運用に乗せるまで
vivion
1
320
AWS re:Invent 2026 FSI Pre-Event Networking Night
junjikoide
0
420
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Mind Mapping
helmedeiros
1
460
Rails Girls Zürich Keynote
gr2m
96
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
How to Talk to Developers About Accessibility
jct
2
630
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
860
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
So, you think you're a good person
axbom
PRO
2
2.3k
It's Worth the Effort
3n
188
30k
The Language of Interfaces
destraynor
162
27k
Git: the NoSQL Database
bkeepers
PRO
433
67k