<commit_before>const $ = require('gulp')
const changed = require('gulp-changed')
const imagemin = require('gulp-imagemin')
const imageminPngquant = require('imagemin-pngquant')
const plumber = require('gulp-plumber')
const responsive = require('gulp-responsive')
const swPrecache = require('sw-precache')

const dest = 'static'

const iconWidths = [
  310, 192, 180, 160, 152, 150, 144, 120, 114, 96, 76, 72, 70, 64, 60, 57, 32, 16
]

$.task('default', ['images'])

$.task('sw-precache', cb => {
  const rootDir = 'public'

  swPrecache.write(`${rootDir}/sw.js`, {
    staticFileGlobs: [
      rootDir + '/**/*.{js,css,json,woff}',
      rootDir + '/404.html',
      rootDir + '/offline/index.html',
      rootDir + '/icon/*.png'
    ],
    stripPrefix: rootDir
  }, cb)
})

$.task('images', ['images:raster', 'images:vector'])

$.task('images:raster', () => $
  .src('media/**/*.{gif,jpeg,jpg,png}')
  .pipe(plumber())
  .pipe(changed(dest))
  .pipe(responsive({
    'icon/*.png': iconWidths
      .map(width => ({ width, rename: { suffix: `-${width}` } }))
      .concat({ width: 512 }),<commit_msg>Runtime caching<commit_after>const $ = require('gulp')
const changed = require('gulp-changed')
const imagemin = require('gulp-imagemin')
const imageminPngquant = require('imagemin-pngquant')
const plumber = require('gulp-plumber')
const responsive = require('gulp-responsive')
const swPrecache = require('sw-precache')

const dest = 'static'

const iconWidths = [
  310, 192, 180, 160, 152, 150, 144, 120, 114, 96, 76, 72, 70, 64, 60, 57, 32, 16
]

$.task('default', ['images'])

$.task('sw-precache', cb => {
  const rootDir = 'public'

  swPrecache.write(`${rootDir}/sw.js`, {
    staticFileGlobs: [
      rootDir + '/**/*.{js,css,json,woff}',
      rootDir + '/404.html',
      rootDir + '/offline/index.html',
      rootDir + '/icon/*.png'
    ],
    stripPrefix: rootDir,
    runtimeCaching: [{
      urlPattern: /.*/,
      handler: 'networkFirst'
    }]
  }, cb)
})

$.task('images', ['images:raster', 'images:vector'])

$.task('images:raster', () => $
  .src('media/**/*.{gif,jpeg,jpg,png}')
  .pipe(plumber())
  .pipe(changed(dest))
  .pipe(responsive({
    'icon/*.png': iconWidths
      .map(width => ({ width, rename: { suffix: `-${width}` } }))
      .concat({ width: 512 }),
{'fraction_non_alphanumeric': 0.21537789427697684, 'fraction_numerical': 0.04456094364351245, 'mean_word_length': 3.7510373443983402, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3247007', 'n_tokens_mistral': 938, 'n_tokens_neox': 818, 'n_words': 167}