Is there a way for Penthouse to get critical css with javascript enabled?

402 Views Asked by At

I'm using laravel-mix-criticalcss npm package to get the critical css of my site.

Under the hood it uses Penthouse and you can set Penthouse setting in your webpack.mix.js in the critical options.

Penthouse docs docs state:

Generally you have to ensure that all elements you want styled in the critical css appears (visible) in the HTML of your page (with Javascript disabled)

This is not going to be possible on our site. I know you can give some Puppeteer settings in the penthouse settings. Is there a way to make it so JavaScript will be enabled?

1

There are 1 best solutions below

0
BritishSam On

There's a blockJSRequests option.

mix.criticalCss({
    options: {
        penthouse: {
            blockJSRequests: false,
        }
    },
})