WebDevStudios / wd_f

GNU General Public License v2.0
11 stars 1 forks source link

Investigate Critical CSS Errors #9

Closed martinDolan closed 1 year ago

martinDolan commented 1 year ago

I'm seeing some PHP errors on the frontend before any development work has been done.

Screen Shot 2023-06-21 at 4 36 15 PM

I ran a quick test by adding a critical.css file to /build in the root of the theme. This resolves the PHP errors. Ideally, we need a SCSS file that builds to critical.css so that we have a place to store our critical CSS.

Steps to reproduce:

  1. Install Query Monitor or view PHP error log See errors
    include(/Users/marty/Local Sites/wdf-testing/app/public/wp-content/themes/wd_f/build/critical.css): Failed to open stream: No such file or directory
include(): Failed opening '/Users/marty/Local Sites/wdf-testing/app/public/wp-content/themes/wd_f/build/critical.css' for inclusion (include_path='.:/usr/share/php:/www/wp-content/pear')
itsamoreh commented 1 year ago

I closed #15 as a duplicate of this, but bringing the comment over here - is critical.css relevant anymore? Especially doing it manually. IMO we should just get rid of it instead of spending time fixing this. We can add critical.css on a per-project basis if FCP is a big problem on that project.

https://web.dev/extract-critical-css/ https://csswizardry.com/2022/09/critical-css-not-so-fast/

martinDolan commented 1 year ago

Thanks for the resources and thoughts, @itsamoreh. I've gone ahead and removed the critical css and references to it in a PR.

martinDolan commented 1 year ago

This was merged with PR #18 closing this