<commit_before>'use strict';

// import autoprefixer from 'gulp-autoprefixer';
import autoprefixer from 'autoprefixer';
import cache from 'gulp-cached';
import colorguard from 'colorguard';
// import csscomb from 'gulp-csscomb';
// import cssmin from 'gulp-cssmin';
import cssnano from 'cssnano';
// import csso from 'gulp-csso';
import csswring from 'csswring';
import debug from 'gulp-debug';
import doiuse from 'doiuse';
import filter from 'gulp-filter';
import gulp from 'gulp';
// import gulpIgnore from 'gulp-ignore';
// import minifyCss from 'gulp-minify-css';
import plumber from 'gulp-plumber';
import postcss from 'gulp-postcss';
import remember from 'gulp-remember';
// import rtlcss from 'rtlcss';
import sass from 'gulp-sass';
import sassInheritance from 'gulp-sass-inheritance';
import sassLint from 'gulp-sass-lint';
import scss from 'postcss-scss';
import size from 'gulp-size';
import sourcemaps from 'gulp-sourcemaps';
// import stylelint from 'stylelint';
// import uncss from 'gulp-uncss';

import {config, browserSync} from './_config.babel.js';
import reportError from './_report-error.babel.js';

let sourceFiles = config.files.source.styles;

sourceFiles = sourceFiles.concat(config.files.source.stylesIgnored.map(function(path) {
  return '!' + path;
}));
// console.log('sourceFiles', sourceFiles);

gulp.task('styles', () => {
  // stream not returned, see:
  // https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes#gulp-watch-stops-working-on-an-error
  // run from base to include files in elements folder
  gulp.src(sourceFiles)
    .pipe(plumber({
      errorHandler: reportError
    }))
    .pipe(cache('styles (copy scss)')) // only pass through changed files
    .pipe(debug({
      title: 'styles (copy scss):'
    }))
    .pipe(gulp.dest(config.path.destination.styles))
    .pipe(plumber.stop())
    .on('error', reportError);

  gulp.src(sourceFiles)
    .pipe(plumber({
      errorHandler: reportError
    }))
    .pipe(sourcemaps.init({
      debug: true
      // loadMaps: true
    }))
    .pipe(cache('styles (generate css)')) // only pass through changed files
    .pipe(debug({
      title: 'styles (generate css):'
    }))
    // .pipe(gulpIgnore.exclude(sourceFilesIgnored)) // sass-lint can't process interpolated property selectors
    .pipe(sassLint({
      config: config.path.root + '/.sass-lint.yml'
    }))
    .pipe(sassLint.format())
    .pipe(sassLint.failOnError())
    // .pipe(gulpIgnore.include(sourceFiles)) // sass-lint can't process interpolated property selectors
    .pipe(postcss([
      autoprefixer({
        browsers: ['last 1 version']
      }),
      doiuse,
      colorguard,
      // mqpacker,
      csswring,
      // stylelint,
      // rtlcss,
      cssnano
    ], {
      syntax: scss
    }))
    .pipe(sassInheritance({
      dir: config.path.source.styles
    }))
    .pipe(filter(function(file) {
      return !/\/_/.test(file.path) || !/^_/.test(file.relative);
    }))
    .pipe(
      sass({
        errLogToConsole: true,
        includePaths: [
          config.path.source.bowerComponents,
          config.path.source.nodeModules
          // config.path.source.styles<commit_msg>Check SASS inheritance before passing to PostCSS<commit_after>'use strict';

// import autoprefixer from 'gulp-autoprefixer';
import autoprefixer from 'autoprefixer';
import cache from 'gulp-cached';
import colorguard from 'colorguard';
// import csscomb from 'gulp-csscomb';
// import cssmin from 'gulp-cssmin';
import cssnano from 'cssnano';
// import csso from 'gulp-csso';
import csswring from 'csswring';
import debug from 'gulp-debug';
import doiuse from 'doiuse';
import filter from 'gulp-filter';
import gulp from 'gulp';
// import gulpIgnore from 'gulp-ignore';
// import minifyCss from 'gulp-minify-css';
import plumber from 'gulp-plumber';
import postcss from 'gulp-postcss';
import remember from 'gulp-remember';
// import rtlcss from 'rtlcss';
import sass from 'gulp-sass';
import sassInheritance from 'gulp-sass-inheritance';
import sassLint from 'gulp-sass-lint';
import scss from 'postcss-scss';
import size from 'gulp-size';
import sourcemaps from 'gulp-sourcemaps';
// import stylelint from 'stylelint';
// import uncss from 'gulp-uncss';

import {config, browserSync} from './_config.babel.js';
import reportError from './_report-error.babel.js';

let sourceFiles = config.files.source.styles;

sourceFiles = sourceFiles.concat(config.files.source.stylesIgnored.map(function(path) {
  return '!' + path;
}));
// console.log('sourceFiles', sourceFiles);

gulp.task('styles', () => {
  // stream not returned, see:
  // https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes#gulp-watch-stops-working-on-an-error
  // run from base to include files in elements folder
  gulp.src(sourceFiles)
    .pipe(plumber({
      errorHandler: reportError
    }))
    .pipe(cache('styles (copy scss)')) // only pass through changed files
    .pipe(debug({
      title: 'styles (copy scss):'
    }))
    .pipe(gulp.dest(config.path.destination.styles))
    .pipe(plumber.stop())
    .on('error', reportError);

  gulp.src(sourceFiles)
    .pipe(plumber({
      errorHandler: reportError
    }))
    .pipe(sourcemaps.init({
      debug: true
      // loadMaps: true
    }))
    .pipe(cache('styles (generate css)')) // only pass through changed files
    .pipe(debug({
      title: 'styles (generate css):'
    }))
    // .pipe(gulpIgnore.exclude(sourceFilesIgnored)) // sass-lint can't process interpolated property selectors
    .pipe(sassLint({
      config: config.path.root + '/.sass-lint.yml'
    }))
    .pipe(sassLint.format())
    .pipe(sassLint.failOnError())
    // .pipe(gulpIgnore.include(sourceFiles)) // sass-lint can't process interpolated property selectors
    .pipe(sassInheritance({
      dir: config.path.source.styles
    })) // returns nothing if the main scss file does not contain any import statements
    .pipe(postcss([
      autoprefixer({
        browsers: ['last 1 version']
      }),
      doiuse,
      colorguard,
      // mqpacker,
      csswring,
      // stylelint,
      // rtlcss,
      cssnano
    ], {
      syntax: scss
    }))
    .pipe(filter(function(file) {
      return !/\/_/.test(file.path) || !/^_/.test(file.relative);
    }))
    .pipe(
      sass({
        errLogToConsole: true,
        includePaths: [
          config.path.source.bowerComponents,
          config.path.source.nodeModules
          // config.path.source.styles
{'fraction_non_alphanumeric': 0.1441996610691727, 'fraction_numerical': 0.0003081189339084887, 'mean_word_length': 3.207388204795852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5800726', 'n_tokens_mistral': 2169, 'n_tokens_neox': 2127, 'n_words': 490}