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 · Fixed by #73
Closed

Add index module #70

blond opened this issue Oct 27, 2014 · 3 comments · Fixed by #73
Assignees
Milestone

Comments

@blond
Copy link
Member

blond 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
Copy link
Member Author

blond commented Oct 27, 2014

/сс @tadatuta @arikon

@arikon
Copy link
Member

arikon commented Oct 27, 2014

👍

@blond
Copy link
Member Author

blond commented Oct 28, 2014

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

@blond blond added this to the 0.1 milestone Oct 28, 2014
@blond blond closed this as completed in #73 Oct 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants