This repository was archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 677
This repository was archived by the owner on Sep 15, 2023. It is now read-only.
additionalTasks access rev-manifest #569
Copy link
Copy link
Open
Labels
Description
I've written an additionTask
for critical css
:
additionalTasks: {
initialize(gulp, PATH_CONFIG, TASK_CONFIG) {
var projectDestPath = path.resolve(process.env.INIT_CWD, PATH_CONFIG.dest);
var revManifestPath = path.resolve(projectDestPath, 'rev-manifest.json');
gulp.task('criticalCss', function () {
loadJsonFile(revManifestPath).then(json => {
critical.generate({
base: projectDestPath,
src: 'index.html',
inline: true,
target: {
html: path.resolve(projectDestPath,'index-critical.html'),
uncritical: path.resolve(projectDestPath, json['css/app.css'].replace('.css', '-uncritical.css'))
},
minify: true,
extract: true,
});
});
});
},
development: {
prebuild: null,
postbuild: null,
},
production: {
prebuild: null,
postbuild: ['criticalCss']
}
}
however production.postbuild
executes before replaceFiles
task therefore it will never have access to rev-manifest.json
:
(productionTask)
gulpSequence(prebuild, tasks.assetTasks, tasks.codeTasks, rev, 'size-report', static, postbuild, 'replaceFiles', cb)
At this time, I can only get my criticalCss
task to work only if I update productionTask
to:
gulpSequence(prebuild, tasks.assetTasks, tasks.codeTasks, rev, 'size-report', static, 'replaceFiles', postbuild, cb)
Perhaps we could add another hook for this kind of case, something like:
gulpSequence(prebuild, tasks.assetTasks, tasks.codeTasks, rev, 'size-report', static, postbuild, 'replaceFiles', postreplacefiles, cb)