<commit_before>var fs = require('fs');
var gulp = require('gulp');
var usemin = require('gulp-usemin');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var cleanCSS = require('gulp-clean-css');
var del = require('del')
var rev = require('gulp-rev')
var realFavicon = require('gulp-real-favicon');
var copy = require('gulp-copy');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var svgInject = require('svg-injectr');
var htmlmin = require('gulp-htmlmin');
var through = require('through2');
var processhtml = require('gulp-processhtml');

// File where the favicon markups are stored
var FAVICON_DATA_FILE = 'cache/faviconData.json';

gulp.task('copy:fonts', ['clean'], function() {
  return gulp.src('assets/css/font/**/*.{ttf,woff,woff2,eot,svg}')
      .pipe(gulp.dest('public/font'));
});

gulp.task('copy:assets', ['clean'], function() {
  var assets_paths = [
    'assets/svg/*',
    'assets/img/**/*',
    'vendor/**/*'
  ]
  
  return gulp.src(assets_paths)
             .pipe(copy('public'));
});

gulp.task('copy:favicon', ['clean'], function() {
  return gulp.src('cache/favicon/*')
      .pipe(gulp.dest('public'));
});



gulp.task('minify', ['clean'], function() {

  var cleancssOpt = {advanced:false, aggressiveMerging:false, restructuring:false}
  
  var processors = [autoprefixer({browsers: ['last 2 version']})];

  return gulp.src('index.html')
      .pipe(usemin({
        css: [ cleanCSS(cleancssOpt), postcss(processors), rev ],
        vendorjs: [ uglify, rev ]
      }))
      .pipe(gulp.dest('public'));
});


gulp.task('clean', function() {
  return del([
    'public/**/**/*',
    // don't remove .gitkeep
    '!public/.gitkeep'
  ]);
});

// Generate the icons. This task takes a few seconds to complete. 
// You should run it at least once to create the icons. Then, 
// you should run it whenever RealFaviconGenerator updates its 
// package (see the check-for-favicon-update task below).
gulp.task('generate-favicon', function(done) {
  realFavicon.generateFavicon({
    masterPicture: 'favicon.svg',
    dest: 'cache/favicon',
    iconsPath: '/',
    design: {
      ios: {
        pictureAspect: 'backgroundAndMargin',
        backgroundColor: '#ffffff',
        margin: '14%'
      },
      desktopBrowser: {},
      windows: {
        pictureAspect: 'noChange',
        backgroundColor: '#da532c',
        onConflict: 'override'
      },
      androidChrome: {
        pictureAspect: 'shadow',
        themeColor: '#ffffff',
        manifest: {
          name: 'Cryptoloji',
          display: 'browser',
          orientation: 'notSet',
          onConflict: 'override',
          declared: true
        }
      },
      safariPinnedTab: {
        pictureAspect: 'silhouette',
        themeColor: '#5bbad5'
      }
    },
    settings: {
      compression: 2,
      scalingAlgorithm: 'Mitchell',
      errorOnImageTooSmall: false
    },
    markupFile: FAVICON_DATA_FILE
  }, function() {
    done();
  });
});





// inject svg into the index file and strip away the illustrator file, if present
gulp.task('svginj', ['copy:assets'], function(){
  gulp.src('public/index.html')
    // .pipe(through.obj(function (chunk, enc, cb) {
    //   svgInject({source:chunk.path, selector:'data-svg'}, function(res){
    //     chunk.contents = new Buffer(res)
    //     cb(null, chunk);
    //   })
    // }))
    .pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
    .pipe(processhtml({
      commentMarker: 'process',
      recursive:true,
      data:{version:Math.random()*10000}
    }))<commit_msg>fixed absurd bug<commit_after>var fs = require('fs');
var gulp = require('gulp');
var usemin = require('gulp-usemin');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var cleanCSS = require('gulp-clean-css');
var del = require('del')
var rev = require('gulp-rev')
var realFavicon = require('gulp-real-favicon');
var copy = require('gulp-copy');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var svgInject = require('svg-injectr');
var htmlmin = require('gulp-htmlmin');
var through = require('through2');
var processhtml = require('gulp-processhtml');

// File where the favicon markups are stored
var FAVICON_DATA_FILE = 'cache/faviconData.json';

gulp.task('copy:fonts', ['clean'], function() {
  return gulp.src('assets/css/font/**/*.{ttf,woff,woff2,eot,svg}')
      .pipe(gulp.dest('public/font'));
});

gulp.task('copy:assets', ['clean'], function() {
  var assets_paths = [
    'assets/svg/*',
    'assets/img/**/*',
    'vendor/**/*'
  ]
  
  return gulp.src(assets_paths)
             .pipe(copy('public'));
});

gulp.task('copy:favicon', ['clean'], function() {
  return gulp.src('cache/favicon/*')
      .pipe(gulp.dest('public'));
});



gulp.task('minify', ['clean'], function() {

  var cleancssOpt = {advanced:false, aggressiveMerging:false, restructuring:false}
  
  var processors = [autoprefixer({browsers: ['last 2 version']})];

  return gulp.src('index.html')
      .pipe(usemin({
        css: [ cleanCSS(cleancssOpt), postcss(processors), rev ],
        vendorjs: [ uglify, rev ]
      }))
      .pipe(gulp.dest('public'));
});


gulp.task('clean', function() {
  return del([
    'public/**/**/*',
    // don't remove .gitkeep
    '!public/.gitkeep'
  ]);
});

// Generate the icons. This task takes a few seconds to complete. 
// You should run it at least once to create the icons. Then, 
// you should run it whenever RealFaviconGenerator updates its 
// package (see the check-for-favicon-update task below).
gulp.task('generate-favicon', function(done) {
  realFavicon.generateFavicon({
    masterPicture: 'favicon.svg',
    dest: 'cache/favicon',
    iconsPath: '/',
    design: {
      ios: {
        pictureAspect: 'backgroundAndMargin',
        backgroundColor: '#ffffff',
        margin: '14%'
      },
      desktopBrowser: {},
      windows: {
        pictureAspect: 'noChange',
        backgroundColor: '#da532c',
        onConflict: 'override'
      },
      androidChrome: {
        pictureAspect: 'shadow',
        themeColor: '#ffffff',
        manifest: {
          name: 'Cryptoloji',
          display: 'browser',
          orientation: 'notSet',
          onConflict: 'override',
          declared: true
        }
      },
      safariPinnedTab: {
        pictureAspect: 'silhouette',
        themeColor: '#5bbad5'
      }
    },
    settings: {
      compression: 2,
      scalingAlgorithm: 'Mitchell',
      errorOnImageTooSmall: false
    },
    markupFile: FAVICON_DATA_FILE
  }, function() {
    done();
  });
});





// inject svg into the index file and strip away the illustrator file, if present
gulp.task('svginj', ['copy:assets'], function(){
  gulp.src('public/index.html')
    .pipe(through.obj(function (chunk, enc, cb) {
      svgInject({source:chunk.path, selector:'data-svg'}, function(res){
        chunk.contents = new Buffer('<!DOCTYPE html>' + res)
        cb(null, chunk);
      })
    }))
    .pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
    .pipe(processhtml({
      commentMarker: 'process',
      recursive:true,
      data:{version:Math.random()*10000}
    }))
{'fraction_non_alphanumeric': 0.1698444895199459, 'fraction_numerical': 0.0043272481406355645, 'mean_word_length': 3.1691093573844418, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2424551', 'n_tokens_mistral': 2494, 'n_tokens_neox': 2420, 'n_words': 498}