<commit_before>#!/usr/bin/env node

'use strict';

const path            = require('path');
const fs              = require('fs-extra');
const boxen           = require('boxen');
const clipboardy      = require('clipboardy');
const gulp            = require('gulp');
const util            = require('gulp-util');
const plumber         = require('gulp-plumber');
const replace         = require('gulp-replace');
const rename          = require('gulp-rename');
const gulpIf          = require('gulp-if');
const watch           = require('gulp-watch');
const beml            = require('gulp-beml');
const iconizer        = require('../modules/gulp-iconizer');
const svgSprite       = require('gulp-svg-sprite');
const batch           = require('gulp-batch');
const changed         = require('gulp-changed');
const stylus          = require('gulp-stylus');
const less            = require('gulp-less');
const scss            = require('gulp-sass');
const postcss         = require('gulp-postcss');
const flexBugsFixes   = require('postcss-flexbugs-fixes');
const focus           = require('postcss-focus');
const discardComments = require('postcss-discard-comments');
const inlineSvg       = require('postcss-inline-svg');
const svgo            = require('postcss-svgo');
const groupCssMQ      = require('gulp-group-css-media-queries');
const babel           = require('gulp-babel');
const uglify          = require('gulp-uglify');
const jscs            = require('gulp-jscs');
const include         = require('gulp-include');
const cssnano         = require('cssnano');
const autoprefixer    = require('autoprefixer');
const runSequence     = require('run-sequence');
const bs              = require('browser-sync').create();
const CLI             = require('commander');
const chalk           = require('chalk');
const pkg             = require('../package.json');
const getAuthParams   = (params) => typeof params !== 'string' ? [pkg.name, false] : params.split('@');

let config = {};


CLI
    .version(pkg.version)
    .option('-a, --auth [user@password]', `установка логина и пароля для авторизации`)
    .option('--proxy [url]', 'URL для прокси')
    .option('-p, --port <n>', 'порт для прокси', 8300)
    .option('-t, --tech [tech]', 'CSS пре-процессор styl, scss, less (по умолчанию styl)', /^(styl|scss|less)$/i, 'styl')
    .option('-n, --nano', 'включить cssnano')
    .option('-o, --open', 'открывать браузер при старте')
    .parse(process.argv);


/**
 * Проверка правильности установки логина и пароля для авторизации
 */
bs.use(require('bs-auth'), {
    user: getAuthParams(CLI.auth)[0],
    pass: getAuthParams(CLI.auth)[1],
    use: CLI.auth
});

gulp.task('beml', (done) => {

    let stream = gulp.src(config.components.src)
        .pipe(plumber())
        .pipe(changed(config.components.dest))
        .pipe(iconizer({ path : config.iconizer.spritePath}))
        .pipe(beml(config.components.opts))
        .pipe(rename(config.components.rename))
        .pipe(gulp.dest(config.components.dest));

    stream.on('end', function () {

        bs.reload();

        console.log(`[ ${chalk.green('BEML')} ] task complete`);

        done();
    });

    stream.on('error', function (err) {
        done(err);
    });
});


const stylePreProcessor = (tech) => {

    switch (tech) {

        case 'styl':
            return stylus({
                'include css': true
            });
        break;

        case 'scss':
            return scss();
        break;

        case 'less':
            return less();
        break;

        default:
            console.log('Не выбран CSS пре-процессор, проверьте настройки проекта');
    }
}


gulp.task('styles', () => {

    let plugins = [
        discardComments(),
        focus(),
        inlineSvg(),
        svgo(),
        autoprefixer(config.kakadu.autoprefixer),
        flexBugsFixes()
    ];

    /**
     * Включение cssnano для оптимизации стилей проекта
     */
    if (CLI.nano) {
        plugins.push(cssnano(config.kakadu.cssnano));
    }

    gulp.src(config.css.src)<commit_msg>Перенёс удаление комментов в комплект с cssnano<commit_after>#!/usr/bin/env node

'use strict';

const path            = require('path');
const fs              = require('fs-extra');
const boxen           = require('boxen');
const clipboardy      = require('clipboardy');
const gulp            = require('gulp');
const util            = require('gulp-util');
const plumber         = require('gulp-plumber');
const replace         = require('gulp-replace');
const rename          = require('gulp-rename');
const gulpIf          = require('gulp-if');
const watch           = require('gulp-watch');
const beml            = require('gulp-beml');
const iconizer        = require('../modules/gulp-iconizer');
const svgSprite       = require('gulp-svg-sprite');
const batch           = require('gulp-batch');
const changed         = require('gulp-changed');
const stylus          = require('gulp-stylus');
const less            = require('gulp-less');
const scss            = require('gulp-sass');
const postcss         = require('gulp-postcss');
const flexBugsFixes   = require('postcss-flexbugs-fixes');
const focus           = require('postcss-focus');
const discardComments = require('postcss-discard-comments');
const inlineSvg       = require('postcss-inline-svg');
const svgo            = require('postcss-svgo');
const groupCssMQ      = require('gulp-group-css-media-queries');
const babel           = require('gulp-babel');
const uglify          = require('gulp-uglify');
const jscs            = require('gulp-jscs');
const include         = require('gulp-include');
const cssnano         = require('cssnano');
const autoprefixer    = require('autoprefixer');
const runSequence     = require('run-sequence');
const bs              = require('browser-sync').create();
const CLI             = require('commander');
const chalk           = require('chalk');
const pkg             = require('../package.json');
const getAuthParams   = (params) => typeof params !== 'string' ? [pkg.name, false] : params.split('@');

let config = {};


CLI
    .version(pkg.version)
    .option('-a, --auth [user@password]', `установка логина и пароля для авторизации`)
    .option('--proxy [url]', 'URL для прокси')
    .option('-p, --port <n>', 'порт для прокси', 8300)
    .option('-t, --tech [tech]', 'CSS пре-процессор styl, scss, less (по умолчанию styl)', /^(styl|scss|less)$/i, 'styl')
    .option('-n, --nano', 'включить cssnano')
    .option('-o, --open', 'открывать браузер при старте')
    .parse(process.argv);


/**
 * Проверка правильности установки логина и пароля для авторизации
 */
bs.use(require('bs-auth'), {
    user: getAuthParams(CLI.auth)[0],
    pass: getAuthParams(CLI.auth)[1],
    use: CLI.auth
});

gulp.task('beml', (done) => {

    let stream = gulp.src(config.components.src)
        .pipe(plumber())
        .pipe(changed(config.components.dest))
        .pipe(iconizer({ path : config.iconizer.spritePath}))
        .pipe(beml(config.components.opts))
        .pipe(rename(config.components.rename))
        .pipe(gulp.dest(config.components.dest));

    stream.on('end', function () {

        bs.reload();

        console.log(`[ ${chalk.green('BEML')} ] task complete`);

        done();
    });

    stream.on('error', function (err) {
        done(err);
    });
});


const stylePreProcessor = (tech) => {

    switch (tech) {

        case 'styl':
            return stylus({
                'include css': true
            });
        break;

        case 'scss':
            return scss();
        break;

        case 'less':
            return less();
        break;

        default:
            console.log('Не выбран CSS пре-процессор, проверьте настройки проекта');
    }
}


gulp.task('styles', () => {

    let plugins = [
        focus(),
        inlineSvg(),
        svgo(),
        autoprefixer(config.kakadu.autoprefixer),
        flexBugsFixes()
    ];

    /**
     * Включение cssnano для оптимизации стилей проекта
     */
    if (CLI.nano) {
        plugins.push(discardComments());
        plugins.push(cssnano(config.kakadu.cssnano));
    }

    gulp.src(config.css.src)
{'fraction_non_alphanumeric': 0.162059686888454, 'fraction_numerical': 0.0014677103718199608, 'mean_word_length': 2.424204355108878, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '51696', 'n_tokens_mistral': 2652, 'n_tokens_neox': 2674, 'n_words': 531}