All files / tasks/rev assets.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x 1x 1x     1x   1x   1x                         1x  
import * as gulp from 'gulp'
import * as rev from 'gulp-rev'
import { ITimplaTask, projectDestPath, revNapkin, TIMPLA_PROCESS } from '../../internal'
 
// 1) Add md5 hashes to assets referenced by CSS and JS files
const revAssets: ITimplaTask = timplaConfig => () => {
  // Ignore files that may reference assets. We'll rev them next.
  const ignoreThese = `!${projectDestPath('**/*+(css|js|map|json|html)')}`
 
  return gulp
    .src([projectDestPath('**/*'), ignoreThese])
    .pipe(rev())
    .pipe(gulp.dest(timplaConfig.dest))
    .pipe(revNapkin({ verbose: false, force: true, fallbackCwd: TIMPLA_PROCESS.PROCESS_CWD }))
    .pipe(
      rev.manifest(projectDestPath('rev-manifest.json'), {
        merge: true,
      })
    )
    .pipe(gulp.dest('./'))
}
 
export default revAssets