How to configure Critical to generate critical CSS

Created on 6 December 2024, 21 days ago

I am trying to implement this module for my site (10.3.10) and am hoping to use the recommended critical package from addyosmani. However, I can't figure out how to actually configure the package to generate the critical CSS files from my Drupal site. I am building the tooling in gulp. Here's what I have so far:

// FYI: vars.dist_directory is an imported variable w/ path information. 

gulp.task('critical', () => {
   import("critical").then((critical)=>{
       critical.generate({
        base: vars.dist_directory,
        src: 'index.html',
        target: vars.dist_directory + "css",
        width: 1300,
        height: 900,
      });
   });

The blocker right now is what I should put for the src property. The error I'm getting is "Error: File not found: static/assets/index.html", which makes sense as it doesn't exist. What do I use to make this work for a Drupal site?

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States superfluousapostrophe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024