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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import * as gulp from 'gulp'
import { IFullTimplaConfig, ITimplaTask, setDisplayName } from '../../internal'
import createAssets from './assets'
import createCss from './css'
import createUpdateHtml from './updateHtml'
import createUpdateReferences from './updateReferences'
const revTasks = (timplaConfig: IFullTimplaConfig) => {
const assetsRevEnabled = !!(
timplaConfig.staticFiles ||
timplaConfig.images ||
timplaConfig.fonts ||
timplaConfig.svg
)
const updateReferencesEnabled = !!(timplaConfig.stylesheets || timplaConfig.javascripts)
const assets = assetsRevEnabled && createAssets(timplaConfig)
const updateReferences = updateReferencesEnabled && createUpdateReferences(timplaConfig)
const css = !!timplaConfig.stylesheets && createCss(timplaConfig)
const updateHtml = !!timplaConfig.html && createUpdateHtml(timplaConfig)
setDisplayName(assets, 'assets')
setDisplayName(updateReferences, 'updateReferences')
setDisplayName(css, 'css')
setDisplayName(updateHtml, 'updateHtml')
return [
// 1) Add md5 hashes to assets referenced by CSS and JS files
assets,
// 2) Update asset references (images, fonts, etc) with reved filenames in compiled css + js
updateReferences,
// 3) Rev and compress CSS and JS files (this is done after assets, so that if a referenced asset hash changes, the parent hash will change as well
css,
// 4) Update asset references in HTML
updateHtml,
].filter(Boolean)
}
// If you are familiar with Rails, this task the equivalent of `rake assets:precompile`
export const rev: ITimplaTask = timplaConfig => cb => {
const toRev: any[] = revTasks(timplaConfig)
return toRev.length ? gulp.series(...toRev)(cb) : cb()
}
|