-
Notifications
You must be signed in to change notification settings - Fork 72
Add ability to write level config module as a function (closes #364, BEM-931) #430
Conversation
@@ -8,8 +8,18 @@ var PATH = require('./path'), | |||
LOGGER = require('./logger'), | |||
isRequireable = bemUtil.isRequireable, | |||
|
|||
BEM, | |||
getBem = function() { | |||
if (!BEM) BEM = require('..'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
У require
же свой кеш есть.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я знаю, не стал полагаться на то что он такой же легкий.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Проверил: действительно твой вариант гораздо быстрее.
/сс @arikon |
getLevelClass = function(path, optional) { | ||
var level = optional && !isRequireable(path) ? {} : requireLevel(path); | ||
|
||
if (typeof level === 'function') level = level(getBem()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Напиши в комментариях в коде суть решения с getBem()
. Я её понимаю, но кто-то при свежем взгляде в код может не понять.
Мне кажется эту фичу можно/нужно влить в 0.6 тоже? |
Add ability to write level config module as a function (closes #364, BEM-931)
Add ability to write level config module as a function (closes #364, BEM-931)
backport: Merge pull request #430 from bem/BEM-931
No description provided.