Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index module #70

Closed
blond opened this issue Oct 27, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@blond
Copy link
Member

commented Oct 27, 2014

Сейчас обычный конфиг выглядит так:

nodeConfig.addTechs([
    [require('enb-bem-techs/techs/levels'), { levels: getLevels(config) }],
    [require('enb/techs/file-provider'), { target: '?.bemjson.js' }],
    [require('enb-bem-techs/techs/bemjson-to-bemdecl')],
    [require('enb-bem-techs/techs/deps-old')],
    [require('enb-bem-techs/techs/files')],
    /* ... */
]);

В каждой строке мы подключаем модуль технологии. Помимо этого, для каждой технологии приходится писать полный путь, относительно пакета enb-bem-techs/techs/tech-name.

Чтобы избавиться от повторов, можно добавить index.js файл в корень пакета, который будет предоставлять объект из всех технологий.

var techs = require('enb-bem-techs');

nodeConfig.addTechs([
    [techs.levels, { levels: getLevels(config) }],
    [require('enb/techs/file-provider'), { target: '?.bemjson.js' }],
    [techs.bemjsonToBemdecl],
    [techs.depsOld],
    [techs.files],
    /* ... */
]);

Технологии должны быть доступны по ключам не только в CamelCase, но и в dash-delim стиле.

var bem = require('enb-bem-techs');

nodeConfig.addTechs([
    [bem['levels'], { levels: getLevels(config) }],
    [require('enb/techs/file-provider'), { target: '?.bemjson.js' }],
    bem['bemjson-to-bemdecl'],
    bem['deps-old'],
    bem['files'],
    /* ... */
]);

@blond blond self-assigned this Oct 27, 2014

@blond

This comment has been minimized.

Copy link
Member Author

commented Oct 27, 2014

@arikon

This comment has been minimized.

Copy link
Member

commented Oct 27, 2014

👍

@blond

This comment has been minimized.

Copy link
Member Author

commented Oct 28, 2014

После обсуждения с @tadatuta решили, что dash-delim стиль не нужен.

@blond blond added this to the 0.1 milestone Oct 28, 2014

@blond blond referenced this issue Oct 28, 2014

Merged

Added index module #73

@blond blond closed this in #73 Oct 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.