Поиск по этому блогу

вторник, 7 июня 2016 г.

Здесь я пробую BEM start-project (Yandex) и добавляю переменные окружения при помощи SET

Установил start-project, запустил сервер... Обнаружил в дистрибутиве make.js, записал сюда. Но сначала записал
set PATH=%cd%\node_modules.bin;%PATH% (для windows) и
export PATH=./node_modules/.bin:$PATH для Linux.
Я никак не запомню, где двоеточие, а где точка с запятой..., а надо бы.

Вспоминаем, как добавить переменные окружения

In [ ]:
export PATH=./node_modules/.bin:$PATH
In [ ]:
set PATH=%cd%\node_modules\.bin;%PATH%
In [ ]:
F:\stradorusite\bem_yandex\start-project>bem server -p 7878
12:42:34.493 - info: bem 0.10.2
12:42:34.509 - debug: http_parser 2.6.1
12:42:34.517 - debug: node 5.6.0
12:42:34.517 - debug: v8 4.6.85.31
12:42:34.521 - debug: uv 1.8.0
12:42:34.525 - debug: zlib 1.2.8
12:42:34.529 - debug: ares 1.10.1-DEV
12:42:34.533 - debug: icu 56.1
12:42:34.537 - debug: modules 47
12:42:34.545 - debug: openssl 1.0.2f
12:42:34.563 - silly: File 'F:\stradorusite\bem_yandex\start-project\.bem\make.js' doesn't exist
12:42:34.567 - info: Trying to use ENB
ENB server started at http://0.0.0.0:7878

Зато есть:

In [ ]:
# %load F:\stradorusite\bem_yandex\start-project\.enb\make.js
var techs = {
        // essential
        fileProvider: require('enb/techs/file-provider'),
        fileMerge: require('enb/techs/file-merge'),

        // optimization
        borschik: require('enb-borschik/techs/borschik'),

        // css
        stylus: require('enb-stylus/techs/stylus'),

        // js
        browserJs: require('enb-diverse-js/techs/browser-js'),
        prependYm: require('enb-modules/techs/prepend-modules'),

        // bemtree
        // bemtree: require('enb-bemxjst/techs/bemtree'),

        // bemhtml
        bemhtml: require('enb-bemxjst/techs/bemhtml'),
        bemjsonToHtml: require('enb-bemxjst/techs/bemjson-to-html')
    },
    enbBemTechs = require('enb-bem-techs'),
    levels = [
        { path: 'libs/bem-core/common.blocks', check: false },
        { path: 'libs/bem-core/desktop.blocks', check: false },
        { path: 'libs/bem-components/common.blocks', check: false },
        { path: 'libs/bem-components/desktop.blocks', check: false },
        { path: 'libs/bem-components/design/common.blocks', check: false },
        { path: 'libs/bem-components/design/desktop.blocks', check: false },
        'common.blocks',
        'desktop.blocks'
    ];

module.exports = function(config) {
    var isProd = process.env.YENV === 'production';

    config.nodes('*.bundles/*', function(nodeConfig) {
        nodeConfig.addTechs([
            // essential
            [enbBemTechs.levels, { levels: levels }],
            [techs.fileProvider, { target: '?.bemjson.js' }],
            [enbBemTechs.bemjsonToBemdecl],
            [enbBemTechs.deps],
            [enbBemTechs.files],

            // css
            [techs.stylus, {
                target: '?.css',
                autoprefixer: {
                    browsers: ['ie >= 10', 'last 2 versions', 'opera 12.1', '> 2%']
                }
            }],

            // bemtree
            // [techs.bemtree, { devMode: process.env.BEMTREE_ENV === 'development' }],

            // bemhtml
            [techs.bemhtml, { devMode: process.env.BEMHTML_ENV === 'development' }],

            // html
            [techs.bemjsonToHtml],

            // client bemhtml
            [enbBemTechs.depsByTechToBemdecl, {
                target: '?.bemhtml.bemdecl.js',
                sourceTech: 'js',
                destTech: 'bemhtml'
            }],
            [enbBemTechs.deps, {
                target: '?.bemhtml.deps.js',
                bemdeclFile: '?.bemhtml.bemdecl.js'
            }],
            [enbBemTechs.files, {
                depsFile: '?.bemhtml.deps.js',
                filesTarget: '?.bemhtml.files',
                dirsTarget: '?.bemhtml.dirs'
            }],
            [techs.bemhtml, {
                target: '?.browser.bemhtml.js',
                filesTarget: '?.bemhtml.files',
                devMode: process.env.BEMHTML_ENV === 'development'
            }],

            // js
            [techs.browserJs],
            [techs.fileMerge, {
                target: '?.pre.js',
                sources: ['?.browser.bemhtml.js', '?.browser.js']
            }],
            [techs.prependYm, { source: '?.pre.js' }],

            // borschik
            [techs.borschik, { sourceTarget: '?.js', destTarget: '?.min.js', freeze: true, minify: isProd }],
            [techs.borschik, { sourceTarget: '?.css', destTarget: '?.min.css', tech: 'cleancss', freeze: true, minify: isProd }]
        ]);

        nodeConfig.addTargets([/* '?.bemtree.js', */ '?.html', '?.min.css', '?.min.js']);
    });
};


Посты чуть ниже также могут вас заинтересовать

Комментариев нет: