quinta-feira, 17 de julho de 2014

Scaling Down The BEM Methodology For Small Projects

Scaling Down The BEM Methodology For Small Projects


  • By Maksim Shirshin

  • July 17th, 2014

  • CSSHTML5JavaScript

  • 0 Comments

Front-end growth is no longer about sold frameworks. Tools are accessible — we merely have to choose. To make a right choices for your project, you need to start with a ubiquitous approach, or methodology. But many methodologies have been total by vast companies? Are they still useful for tiny companies, or do we need to reinvent them during a tiny scale?


You substantially already know of BEM121, one of those methodologies grown by a vast association — namely, Yandex2. BEM posits that 3 elementary entities (blocks, elements and modifiers) are adequate to conclude how to author HTML and CSS, structure formula and components, report interfaces and scale a plan adult to an industry-leading service.


I’ve spent some time with Yandex and BEM, and we know that this methodology works for vast projects. Yandex uses BEM to rise CSS and JavaScript components; Yandex also optimizes templates and marks dependencies in BEM, develops BEM utilities, supports formula experiments and researches a field. On a vast scale, this investment pays off and allows Yandex to rise hundreds of a services faster.


Would smaller teams advantage from BEM? we wasn’t sure. BEM is a covering of abstraction, offering with other collection and technologies. A tiny stretchable group switching to a full BEM smoke-stack would be questionable. Could a thought — a ensue itself — be useful?


To make a right choices for your project, start with a ubiquitous approach, or methodology.
To make a right choices for your project, start with a ubiquitous approach, or methodology.

I had to revisit this doubt when my career recently took me from Yandex to Deltamethod, a mid-sized startup in Berlin. Facing desirous growth plans, we motionless to try BEM on a smaller scale. We wanted a same advantages that Yandex gets from BEM: code sharing, a live character guide, scalability, faster development. We also wanted to keep a toolchain and ascent a existent formula bottom gradually, rather than start from scratch.


For some time, we’ve been focusing on pattern and a basics, perplexing aspects of BEM one by one, assessing a results, afterwards relocating forward. We keep essay down ideas, guidelines, useful tips and brief tutorials. we am now assured that BEM relates to tiny projects as well. I’ve combined down my findings, in box we find them useful. Let’s start by reviewing a basics.


BEM 101


While semantics is deliberate a substructure of web development, several front-end technologies do not share a same semantic model. The HTML of a complicated app is mostly a div soup. CSS by itself does not offer any structured indication during all. High-level JavaScript components use abstractions that are not consistently tied to styles or markup. At a UX level, interfaces are described in terms that have 0 in common with technical implementations. Enter BEM, a one semantic indication for markup, styles, formula and UX. Let’s take a closer look.


Blocks


A retard is an independent entity with a possess meaning that represents a square of interface on a page.


Examples of blocks include:


  • a heading,

  • a button,

  • a navigation menu.

To conclude a block, you’d give it a singular name and mention a semantics. Several instances of a same retard clarification (such as several buttons or mixed menus) competence exist in a interface.


Any web interface can be represented as a hierarchical collection of blocks. The simplest illustration is a HTML structure itself (tags as blocks), though that is semantically invalid since HTML was designed for structured text, not web apps.


Elements


An member is a part of a block, tied to it semantically and functionally. It has no clarification outward of a retard it belongs to. Not all blocks have elements.


Examples of elements include:


  • a navigation menu (block) that contains menu items;

  • a list (block) that contains rows, cells and headings.

Elements have names, too, and identical elements within a retard (such as cells in a grid or equipment in a list) go by a same name. Elements are semantic entities and not accurately a same as HTML layout; a formidable HTML structure could consecrate customarily a singular element.


Modifiers


Modifiers are flags set on blocks or elements; they conclude properties or states. They competence be boolean (for example, visible: true or false) or key-value pairs (size: large, medium, small) — rather identical to HTML attributes, though not accurately a same. Multiple modifiers are authorised on a singular object if they paint opposite properties.


Blocks and a DOM


How do we work with BEM while still regulating HTML? You do it by mapping DOM nodes to BEM entities regulating a fixing convention.


BEM uses CSS category names to imply blocks, elements and modifiers. Blocks, elements or modifiers can't explain any “exclusive ownership” of DOM nodes. One DOM node competence horde several blocks. A node competence be an member within one retard and (at a same time) a enclosure for another block.


A DOM node being reused to horde some-more than one BEM entity is called a “BEM mixin.” Please note that this is customarily a underline of convenience: Only brew things that can be total — don’t spin a brew into a mess.


The BEM Tree


By consistently imprinting adult a request with BEM entities, from a bottom retard (i.e. body or even html) down to a innermost blocks, we form a semantic conceal to a DOM’s existent structure. This conceal is called a BEM tree.


The BEM tree gives we a energy to manipulate a whole request in BEM terms consistently, focusing on semantics and not on a DOM-specific implementation.


Making Your First Move


You competence be thinking, “I’ll give BEM a try. How do we start migrating my plan to BEM? Can we do it incrementally?” Sure. Let’s start by defining some blocks. We will customarily cover semantics; we’ll ensue with specific technologies (like CSS and JavaScript) after on.


As you’ll recall, any standalone thing competence be a block. As an example, request headings are blocks. They go though middle elements, though their levels (from top-most down to a innermost) competence be tangible as key-value modifiers.


If we need some-more levels later, conclude some-more modifiers. we would contend that HTML4 got it wrong with h1 to h6. It finished opposite blocks (tags) of what should have been customarily a modifier property. HTML5 tries to pill this with sectioning elements, though browser support is lagging.


For example, we get this:


BLOCK heading
MOD level: alpha, beta, gamma

As a second example, web form submit controls can be seen as blocks (including buttons). HTML didn’t get it accurately right here either. This time, opposite things (text inputs, radio buttons, check boxes) were total underneath a same input tag, while others (seemingly of a same origin) were tangible with apart tags (select and textarea). Other things, such as label and a auto-suggestion datalist, should be (optional) elements of these blocks since they bear tiny to no clarification on their own.


Let’s see if we can repair this:


BLOCK text-input
MOD multiline
MOD disabled
ELEMENT text-field
ELEMENT label

The essential underline of a content submit is a ability to accept plain text. When we need it to be multiline, 0 changes semantically — that’s since multiline is customarily a modifier. At a HTML level, this is represented by opposite markup for technical reasons, that is also excellent since we’re customarily defining semantics, not a implementation. The textfield tab itself is an element, and label is another element; later, we competence need other elements, like a standing icon, blunder outline placeholder or auto-suggestion.


BLOCK checkbox
ELEMENT tick-box
ELEMENT label

BLOCK radio
ELEMENT radio-button
ELEMENT label

These dual blocks are flattering straightforward. Still, label is an element, and “native” input tags are elements, too.


BLOCK select
MOD disabled
MOD multiple
ELEMENT optgroup
ELEMENT option
MOD disabled
MOD selected

Select boxes don’t unequivocally need labels, and anything else here is some-more or reduction identical to a normal name box control. Technically, we can reuse a existent select tab with all of a structure. Note that both a select retard and a option member have a disabled modifier. These are different modifiers: The initial one disables a whole control, while a second one (being a ideal instance of an member modifier) disables customarily an sold option.


Try to find some-more examples of blocks in your web projects. Classifying things according to BEM takes some practice. Feel giveaway to share your findings, or ask a BEM group your questions3!


Let Your CSS Speak Out Loud


Perhaps you’ve listened a lot about BEM as a proceed to optimize CSS and are wondering how it works?


As mentioned, BEM uses CSS category names to store information about blocks, elements and modifiers. With a elementary fixing convention, BEM teaches your CSS to speak, and it adds clarification that creates it simpler, faster, some-more scalable and easier to maintain.


BEM Naming Conventions for CSS


Here are a prerequisites:


  • Keep a names of blocks, elements and modifiers brief and semantic.

  • Use customarily Latin letters, dashes and digits.

  • Do not use underscores (_), that are indifferent as “separator” characters.

Block containers get a CSS category of a prefix and a retard name:


.b-heading
.b-text-input

That b- prefix stands for “block” and is a default in many BEM implementations. You can use your possess — customarily keep it short. Prefixes are optional, though they obey much-anticipated (and missing!) CSS namespaces.


Element containers within a retard get CSS classes consisting of their retard class, dual underscores and a element’s name:


.b-text-input__label
.b-text-input__text-field

Element names do not simulate a block’s structure. Regardless of nested levels within, it’s always customarily a retard name and a member name (so, never .b-block__elem1__elem2).


Modifiers go to a retard or an element. Their CSS category is a category name of their “owner,” one underscore and a modifier name:


.b-text-input_disabled
.b-select__option_selected

For a “boolean” modifier, this is enough. Some modifiers, however, are key-value pairs with some-more than one probable value. Use another underscore to apart a values:


.b-heading_level_alpha

Modifier classes are used together with a retard and member class, like so:


div class="b-heading b-heading_level_alpha"BEM/div

Why Choose BEM CSS Over Other Approaches


One Class to Rule Them All


CSS infrequently depends a lot on a document’s structure — if we change a structure, we mangle a CSS. With BEM, we can dump tab names and IDs from your CSS completely, regulating customarily category names. This mostly frees we from constructional dependencies.


Specificity Problems Solved


Big chunks of CSS are tough to contend since they keep redefining themselves unpredictably.


This emanate is called CSS specificity. The strange problem is that both tab names and member IDs change selector specificity in such a proceed that if we rest on estate (the many common thing to pattern from CSS), afterwards we can customarily overrule it with selectors of a same or aloft specificity. BEM projects are slightest influenced by this problem. Let’s see why.


Let’s contend we have a list with these character rules:


td.data background-color: white 
td.summary background-color: yellow

However, in another component, we need to redefine a credentials of a sold cell:


.final-summary background-color: immature 

This wouldn’t work since tag.class always has a aloft specificity than customarily .class.


You would supplement a tab name to a sequence to make it work:


td.final-summary background-color: immature 

Because BEM provides singular category names for many styles, we would count customarily on a sequence of rules.


Bye-Bye Cascade?!


Nested CSS selectors aren’t quick adequate in aged browsers and can emanate unintended overrides that mangle a styles of other elements. Eliminating a lot of a cascade from CSS is probable with BEM. How is this possible, and since is it important? Isn’t a cascade supposed to be there? Isn’t it a “C” in CSS)?


As we know, every BEM CSS category is singular and self-sufficient. It does not count on tags or IDs, and opposite blocks never share category names. That’s since we need customarily a singular category name selector to do a following:


  • style a retard container,

  • style any retard element,

  • add character extras and overrides with a modifier.

This covers many of your styling needs, all with customarily one category selector. So, it’s mostly about single-class selectors now, and they are intensely fast. To request a selector, a browser starts with an initial (broader) set of elements (usually dynamic by a rightmost partial of a selector), and afterwards gradually reduces a set by requesting other collection until customarily relating elements remain. The some-more stairs needed, a some-more time it takes, that is since we can frequency kick single-class selectors for speed.


CSS is frequency a opening bottleneck on tiny pages, though CSS manners contingency be reapplied with any request reflow. So, when your plan grows, things will get slower during some point. According to usability science, 250 milliseconds is a notice extent for “instant.” The faster your selectors are, a some-more room we have to stratagem to keep that “blazing fast” feeling for your users.


So, no cascade?! Well, almost. In some cases, we competence need dual category names in a selector — for example, when a retard modifier affects sold elements:


.b-text-input_disabled .b-text-input__label 
display: none;


The good thing is that any sequence that redefines this one will expected count on another modifier (because of a one semantics!), that means that specificity is still a same and customarily a sequence sequence matters. Surely, we can invent some-more cases that need even some-more cascading (internal member dependencies, nested modifiers, etc.). While a BEM methodology allows for that, you’ll frequency ever need it in genuine code.


Absolutely Independent Blocks


If blocks count on any other’s styles, how do we demonstrate that in CSS? The answer is, they shouldn’t. Each retard contingency enclose all styles required for a presentation. The over is minimal, though this ensures that we can pierce blocks openly within a page or even between projects though additional dependencies. Avoid project-wide CSS resets for a same reason.


This is not a box for elements since they are guaranteed to stay within their primogenitor retard and, thus, get retard styles accordingly.


Alternative BEM Naming Conventions


A series of choice BEM fixing conventions exist. Which should we use? BEM’s “official” fixing gathering for CSS is not a customarily one possible. Nicolas Gallagher once proposed4 some improvements, and other adopters have, too. One thought is to use attributes to paint modifiers, and CSS prefixes aren’t “standardized” during all.


The biggest advantage of a syntax due by a group behind BEM is that it’s a one upheld in open-source collection distributed by Yandex, that we competence find accessible during some point. In a end, a methodology is what matters, not a fixing convention; if we confirm to use a opposite convention, customarily make certain we do it for a reason.


Semantic JavaScript: BEM-Oriented Code


Many publishers and authors perspective BEM as a fixing gathering customarily for CSS, though that brings customarily half of a advantages to a project. The BEM methodology was designed to repair (i.e. polyfill) non-semantic DOM structures during all levels (HTML, CSS, JavaScript, templates and UX design), identical to how jQuery “fixes” damaged DOM APIs. HTML was designed as a content markup language, though we use it to build a many interactive interfaces around. Experimental efforts such as Web Components essay to move semantics behind into a markup and code, though BEM can be used in a full operation of browsers now, while maintaining harmony with destiny approaches, since it does not count on any sold API or library.


How do we request a BEM indication to JavaScript code? We’ll go by a growth indication regulating as tiny formula as possible. It will be unequivocally high-level and abstract, though a abstractness will assistance us to know a thought some-more clearly. You’ll notice another tenure in a streamer above: “BEM-oriented code.” Before explaining what’s behind that, let’s go over some ideas that are useful to know when requesting BEM to JavaScript.


Learning to Declare


The initial step is to welcome a declarative paradigm. Declarative programming is an ensue that concentrates on a “what,” not a “how.” Regular expressions, SQL and XSLT are all declarative, and they mention not a control flow, though rather a proof behind it. When doing declarative programming, you’d start by describing a set of conditions, any of them mapped to specific actions.


In BEM, conditions are represented by modifiers, and any movement can customarily occur on a retard or element. The formula examples in this essay will use a i-bem.js framework, combined and open-sourced by Yandex, though your favorite horizon competence be means to do identical or improved things since declarative programming is not tied to a specific implementation.


BEM.DOM.decl('b-dropdown', {
onSetMod:
disabled: function(modName, modVal)
this.getLabel().setMod('hidden', 'yes');
if (modVal === 'yes')
this.getPopup().hide();

,

open:
yes: function()
this.populateList();


,
/* … */

The formula dash above defines actions for dual modifiers on a b-dropdown block. These are identical to eventuality handlers, though all states get immediately reflected in a CSS. Modifiers are still stored as category names on a analogous retard and member entities.


Enabling and disabling opposite pivotal bindings on a b-editor retard is another instance of how to use modifiers:


BEM.DOM.decl('b-editor', {
onSetMod:
hotkeys:
windows: function()
this.delMod('theme');
this.loadKeyMap('windows');
,
emacs: function()
this.setMod('theme', 'unix');
this.loadKeyMap('emacs');
enableEasterEgg();


,
onDelMod:
hotkeys: function()
this.clearKeyMaps();
this.delMod('theme');


/* … */

In this example, we see how modifiers move proof to a transitions in state.


Methods


With a declarative approach, methods are not always “tied” to a member automatically. Instead, they, too, can be declared to go to some instances underneath certain circumstances:


BEM.DOM.decl( name : 'b-popup', modName : 'type', modVal : 'inplace' , 
appear: function()
// makeYouHappy();

);

This routine is tangible customarily for blocks that have a specific type modifier: inplace.


As in classical object-oriented programming, we can extend semantically tangible methods by providing even some-more specific declarations and reuse a strange formula if necessary. So, both overrides and extensions are possible. For example:


BEM.DOM.decl('name': 'b-link', 'modName': 'pseudo', 'modVal': 'yes', 
_onClick : function()
// runs a elementary _onClick defined
// for all b-link instances
this.__base.apply(this, arguments);

// redefine a coming from within CSS,
// this formula customarily gives we a semantic basis!
this.setMod('status', 'clicked');

);

As specified by this definition, a extended _onClick routine runs customarily on b-link instances with a _pseudo_yes modifier. In all other cases, a “original” routine is implemented.


Semantics will solemnly quit from your markup (where it’s not indispensable anymore) to your formula (where it supports modularity and readability, creation it easier to work with).


“… Sitting in a (BEM) Tree”


What is a unsentimental use of a declarative ensue if it is proceed too abstract? The thought is to work with a BEM tree, that is semantic and tranquil by you, instead of a DOM tree, that is tied to a markup and specifics of implementation:


BEM.DOM.decl('b-checkbox-example', 
onSetMod:
js:
inited: function()
var checkbox = this.findBlockInside(
blockName: 'b-form-checkbox',
modName: 'type',
modVal: 'my-checkbox'
);
this.domElem.append('Checkbox value: ' + checkbox.val());




);

Other APIs exist, like this.elem('name') and this.findBlockOutside('b-block'). Instead of providing a finish reference, I’d customarily prominence BEM trees as a API’s foundation.


Modify Modifiers to Control Controls


The prior territory leaves a critical theme of focus state changes unaddressed. When app states are declared, we need a proceed to perform transitions. This should be finished by handling on a BEM tree, with a assistance of modifiers. BEM modifiers can be set directly on DOM nodes (as category names), though we can't effectively guard that (for technical reasons). Instead, i-bem.js provides a elementary API that we can use as inspiration:


// setter
this.setMod(modName, modVal);
// getter
this.getMod(modName);
// check for presence
this.hasMod(modName, modVal);
// toggle
this.toggleMod(modName, modVal);
// mislay modifier
this.delMod(modName);

Thus, we can internally offshoot into a modifier change call and run all of a actions specified for this sold case.


BEM-Oriented Code Explained


Many JavaScript libraries yield adequate energy to support a BEM methodology though introducing a totally new apparatus chain. Here’s a check list to see possibly a one you’re looking during does so:


  • Embraces a declarative approach

  • Defines your website or app in BEM’s terms

    Can many of a project’s existent entities be “mapped” to blocks, elements and modifier properties?

  • Allows we to dump a DOM tree for a BEM tree

    Regardless of any sold horizon API, purify out as many of a tender DOM communication as we can, replacing it with BEM’s tree interaction. During this process, some of a nodes we work with will be redefined as blocks or elements; name them, and see how a loyal semantic structure of your focus reveals itself.

  • Uses modifiers to work with state transitions

    Obviously, we shouldn’t conclude all states with modifiers. Start with a ones that can be voiced in CSS (to censor and exhibit elements, to change character formed on states, etc.), and purify your formula of any proceed strategy of style.

If your horizon of choice can do this, afterwards we are all set for BEM-oriented code.


jQuery users could try these lightweight plugins to extend their formula with BEM methods:


  • jQuery BEM5 plugin

  • jQuery BEM Helpers6 (setMod and getMod)

From A Naming Convention To A Style Guide


If we work a lot with designers, your group would also advantage from a BEM approach. Imagine that we had a character beam total by a Real Designer™. You would customarily get it as a PDF record and be means to learn all about a project’s typefaces, tone schemes, interface communication beliefs and so on. It serves ideally as a striking book that is engaging to demeanour during in your gangling time. However, it would be of tiny to no use to many front-end developers — during a spin of code, front-end developers work with totally opposite entities.


But what if we and a engineer could pronounce with any other regulating a same language? Of course, this would need some training, though a advantages are value it. Your character beam would be an interactive retard library, voiced in BEM terms. Such a library would include of blocks that are prepared to be used to build your product.


Once a engineer is informed with BEM’s terms, they can iterate towards conceptualizing blocks and elements, instead of “screens.” This will also assistance them to brand identical UI collection and harmonize them. Modifiers assistance to conclude visible variations (i.e. that request to all blocks) and states (i.e. for interactive blocks only). The blocks would be granular adequate to capacitate we to make an early determination of a volume of work that needs to be done. The outcome is a selection that entirely covers all critical states that can be reused with other screens or pages. This eventually allows we to ridicule adult interfaces as wireframes or sketches, since all of a building blocks have already been defined. More importantly, this indication maps directly to a formula base, since a blocks, elements and modifiers tangible by a engineer are radically a same blocks, elements and modifiers that a developer will implement. If we have been regulating BEM in your plan for some time, afterwards certain blocks are substantially already available.


The biggest change, however, is shutting a opening between shade and formula by handling on a same entities in a UI pattern and development. Like a famous Babel fish, BEM enables we to know people who have no thought how your formula works.


On a bigger team, operative on sold blocks is easier since it can be finished in parallel, and vast facilities do not finish adult being owned by any one developer. Instead, we share a formula and assistance any other. The some-more we align a JavaScript HTML and CSS with BEM, a reduction time we need to turn informed with new code.


BEM As High-Level Documentation


Despite all advice, developers still don’t write adequate documentation. Moving projects between developers and teams is non-trivial. Code upkeep is all about minimizing a time a developer needs to grasp a component’s structure.


Documentation helps a lot, though let’s be honest, it customarily doesn’t exist. When it does exist, it customarily covers methods, properties and APIs, though frequency anything about a upsurge of components, states or transitions. With minimally structured BEM-oriented code, we will immediately see a following:


  • the elements you’re traffic with,

  • other blocks we count on,

  • states (modifiers) that we need to be wakeful of or support,

  • element modifiers for fine-grained control.

Explaining with examples is easier. What would we contend about a following block?


b-popup
_hidden
_size _big
_medium
_large
_dir _left
_right
_top
_bottom
_color-scheme _dark
_light

__anchor-node
__popup-box
__close-btn
__controls
__ok
__cancel

By now, you can tell me what this retard is about!


Remember, you’ve seen 0 documentation. This retard could be a structure that you’ve tangible in a CSS preprocessor or a YAML meta description.


BEM And File Structure


In a flourishing project, an unsuitable record structure could delayed we down. The structure will customarily turn some-more formidable and reduction stretchable with time. Unfortunately, collection and frameworks do not solve a problem since they possibly understanding with their possess inner information or offer no specific structure during all. You and customarily we contingency conclude a structure for a project. Here, BEM can assistance as well.


Block Library


A block’s folder is a basement of all BEM-based record structures. Block names are singular within a project, as are folder names. Because blocks do not conclude any hierarchies, keep retard folders as a prosaic structure:


/blocks
/b-button
/b-heading
/b-flyout
/b-menu
/b-text-field

Libraries and other dependencies competence be tangible as blocks, too. For example:


/blocks

/b-jquery
/b-model

Inside any folder, a easiest arrangement would be to give any “technology” a graphic file:


/b-menu
b-menu.js
b-menu.css
b-menu.tpl

A some-more modernized ensue would be to store some definitions of elements and modifiers in apart subfolders and afterwards exercise in a modular way:


/b-menu
/__item
b-menu__item.css
b-menu__item.tpl
/_horizontal
b-menu_horizontal.css
/_theme
/_dark
b-menu_theme_dark.css
/_light
b-menu_theme_light.css

b-menu.css
b-menu.js
b-menu.tpl

This gives we control, though it also requires some-more time and bid to support a structure. The choice is yours.


Redefinition Levels


What if we need to extend a styles and functionality of components or share formula between projects though changing (or duplicating and pasting) a strange source?


Big web apps, sections and pages could be significantly different, as could be a blocks they use. At a same time, a common retard library mostly has to be extended, sold equipment redefined and new equipment added. BEM addresses this with a judgment of redefinition levels. As prolonged as you’ve selected a record structure, it should be a same for any block. That’s since several retard libraries can be on opposite levels of an application.


For example, we could have a common retard library as good as several specific libraries for sold pages:


/common
/blocks
/b-heading
/b-menu


/pages
/intro
/blocks
/b-heading
b-heading_decorated.css
/b-demo
/b-wizard


Now, /common/blocks will total blocks used opposite a whole app.


For any page (as for /pages/intro in a example), we conclude a new redefinition level: A specific library, /pages/intro/blocks, adds new blocks and extends some common ones (see a additional _decorated modifier for a common b-heading block).


Your build apparatus can use these levels to yield page-specific builds.


Separation of libraries can be formed on a form factors of devices:


/common.blocks
/desktop.blocks
/mobile.blocks

The common library stays “on top,” while a mobile or desktop retard gold extends it, being a subsequent redefinition level. The same resource relates when several opposite projects need to share blocks or when a cross-project common retard library exists to harmonize a pattern and function opposite several services.


The Build Process


We’ve finished adult with many tiny files, that is good for growth though a disaster for production! In a end, we wish all of a things to be installed in several vast chunks. So, we need a build process.


Yandex has an open-source build tool, Borschik7, that is able of building JavaScript and CSS files and afterwards compressing and optimizing them with outmost tools, such as UglifyJS8 and CSS Optimizer9. Tools like RequireJS10 can also promote a building process, holding caring of dependency tracking.


For a some-more extensive approach, have a demeanour during bem-tools11.


The clearest doctrine I’ve schooled from BEM is not to be fearful of granularity, as prolonged as we know how to build a whole picture.


Beyond Frameworks


For a while, we was flattering doubtful that BEM is suitable for tiny projects. My new knowledge in a startup sourroundings valid me wrong. BEM is not customarily for vast companies. It works for everybody by bringing one semantics opposite all of a front-end technologies that we use.


But that is not a biggest impact of a BEM methodology on my projects. BEM enables we to see over frameworks. we remember times when people severely discussed a best ways to connect eventuality handlers to elements, and when DOM libraries competed for universe dominance, and when frameworks were a subsequent vast buzz. Today, we can no longer count on a singular framework, and BEM takes a subsequent step by providing a pattern foundation, giving us a lot of leisure to implement.


Visit a BEM121 website for additional resources, GitHub links, downloads and articles.


Long story short, BEM it!


(al)



↑ Back to topShare on Twitter



Scaling Down The BEM Methodology For Small Projects

Nenhum comentário:

Postar um comentário