gulp-penthouse icon indicating copy to clipboard operation
gulp-penthouse copied to clipboard

Critical css is not generating

Open vingauta opened this issue 2 years ago • 2 comments

Team,

I am facing issue while generating critical css. Plugin is returning some sort of reset css instead of actual page related css. It was working fine few months back with same configuration what we currently have. Here is my code

promiseArray.push(new Promise((resolve, reject) => { gulp.src(criticalContactCss) .pipe(gulpPenthouse({ url: url, width: width, height: height, renderWaitTime: 3000, pageLoadSkipTimeout: 300000, timeout: 900000, forceInclude: [], forceExclude: [] })) .pipe(concat("critical" + templateName + ".css")) .pipe(require("gulp-clean-css")()) .pipe(gulp.dest(outputPath)) .on("end", resolve) .on("error",reject) }));

Can you please help on this?

Thanks Vinant

vingauta avatar Aug 03 '21 13:08 vingauta

Hi Team,

Any update?

Thanks Vinant

vingauta avatar Aug 05 '21 05:08 vingauta

Hi Vinant,

There is no userAgent defined in the configuration. So the module uses the default userAgent - GoogleBot Desktop.

If the userAgent is deprecated or not supported or if Google Bot is being blocked by the application, Critical CSS will not get generated.

So try specifying a different userAgent in the config, like Google Chrome - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

gulpPenthouse({ url: url, width: width, height: height, renderWaitTime: 3000, pageLoadSkipTimeout: 300000, timeout: 900000, forceInclude: [], forceExclude: [], userAgent: newUserAgent }

amaragain avatar Sep 24 '21 07:09 amaragain