<commit_before>'use strict';

const gulp = require( 'gulp' );
const postcss = require( 'gulp-postcss' );
const sourcemaps = require( 'gulp-sourcemaps' );
// Use terser minifier with gulp-uglify for ES2015 support.
const composer   = require( 'gulp-uglify/composer' );
const terser     = require( 'terser' );
const minify     = composer( terser, console );
const zip = require( 'gulp-zip' );

const paths = {
  styles: {
    src: [ 'assets/styles/*.css', '!assets/styles/variables.css' ],
    dest: 'assets/styles/build/',
    watch: [ 'assets/styles/**/*.css', '!assets/styles/build/**' ]
  },
  scripts: {
    src: 'assets/scripts/*.js',
    dest: 'assets/scripts/build/',
    watch: [ 'assets/scripts/**/*.css', '!assets/scripts/build/**' ]
  }
};

function styles() {
  const processors = [
    require( 'postcss-import' ),
    require( 'postcss-nested' ),
    require( 'postcss-custom-properties' ),
    require( 'postcss-normalize' )( { forceImport: true } ),
    require( 'css-mqpacker' )( { sort: true } ),
    require( 'autoprefixer' ),
    require( 'cssnano' )( {
      preset: [
        'default',
        {
          calc: false,
          mergeLonghand: false // These conflict with processing nested calc() and env values().
        }
      ]
    } )
  ];
  return gulp
    .src( paths.styles.src )
    .pipe( sourcemaps.init() )
    .pipe( postcss( processors ) )
    .pipe( sourcemaps.write( './' ) )
    .pipe( gulp.dest( paths.styles.dest ) );
}

function scripts() {
	return gulp.src( paths.scripts.src )
		.pipe( sourcemaps.init() )
			.pipe( minify() )
		.pipe( sourcemaps.write( './' ) )
		.pipe( gulp.dest( paths.scripts.dest ) );
}

function watch() {
  gulp.watch( paths.styles.watch, styles );
  gulp.watch( paths.scripts.src, scripts );
}

function bundle() {
  return gulp
    .src(
      [
        './*',
        './assets/**',
        './locales/**',
        './partials/**',
        '!./node_modules',
        '!./distribution'
      ],
      { base: '.' }
    )
    .pipe( zip( 'decode.zip' ) )
    .pipe( gulp.dest( './distribution' ) );
}

// Workflows
// $ gulp: Builds, prefixes, and minifies CSS files; concencates and minifies JS files; watches for changes. The works.
const defaultTask = gulp.parallel( styles, scripts, watch );<commit_msg>do not bundle invisible files<commit_after>'use strict';

const gulp = require( 'gulp' );
const postcss = require( 'gulp-postcss' );
const sourcemaps = require( 'gulp-sourcemaps' );
// Use terser minifier with gulp-uglify for ES2015 support.
const composer   = require( 'gulp-uglify/composer' );
const terser     = require( 'terser' );
const minify     = composer( terser, console );
const zip = require( 'gulp-zip' );

const paths = {
  styles: {
    src: [ 'assets/styles/*.css', '!assets/styles/variables.css' ],
    dest: 'assets/styles/build/',
    watch: [ 'assets/styles/**/*.css', '!assets/styles/build/**' ]
  },
  scripts: {
    src: 'assets/scripts/*.js',
    dest: 'assets/scripts/build/',
    watch: [ 'assets/scripts/**/*.css', '!assets/scripts/build/**' ]
  }
};

function styles() {
  const processors = [
    require( 'postcss-import' ),
    require( 'postcss-nested' ),
    require( 'postcss-custom-properties' ),
    require( 'postcss-normalize' )( { forceImport: true } ),
    require( 'css-mqpacker' )( { sort: true } ),
    require( 'autoprefixer' ),
    require( 'cssnano' )( {
      preset: [
        'default',
        {
          calc: false,
          mergeLonghand: false // These conflict with processing nested calc() and env values().
        }
      ]
    } )
  ];
  return gulp
    .src( paths.styles.src )
    .pipe( sourcemaps.init() )
    .pipe( postcss( processors ) )
    .pipe( sourcemaps.write( './' ) )
    .pipe( gulp.dest( paths.styles.dest ) );
}

function scripts() {
	return gulp.src( paths.scripts.src )
		.pipe( sourcemaps.init() )
			.pipe( minify() )
		.pipe( sourcemaps.write( './' ) )
		.pipe( gulp.dest( paths.scripts.dest ) );
}

function watch() {
  gulp.watch( paths.styles.watch, styles );
  gulp.watch( paths.scripts.src, scripts );
}

function bundle() {
  return gulp
    .src(
      [
        './*',
        './assets/**',
        './locales/**',
        './partials/**',
        '!./.*',
        '!./node_modules',
        '!./distribution'
      ],
      { base: '.' }
    )
    .pipe( zip( 'decode.zip' ) )
    .pipe( gulp.dest( './distribution' ) );
}

// Workflows
// $ gulp: Builds, prefixes, and minifies CSS files; concencates and minifies JS files; watches for changes. The works.
const defaultTask = gulp.parallel( styles, scripts, watch );
{'fraction_non_alphanumeric': 0.18261059054260187, 'fraction_numerical': 0.001743299193724123, 'mean_word_length': 2.5498839907192576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3159238', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1561, 'n_words': 348}