2.1.41 • Published 10 months ago

@scullyio/scully-plugin-critical-css v2.1.41

Weekly downloads
205
License
-
Repository
github
Last release
10 months ago

scully-plugin-critical-css

BETA notice: this plugin is still in beta

  • Description: With this Scully render plugin, we will inline the critical above the fold CSS into the HTML, and then "lazy-load" the CSS that is needed for the rest of the page. It will be ready before your SPA will boot. This will remove CSS from being blocking.
  • Type: Render Plugin

This plugins uses the critical tool that is maintained by google, and is listed as the official endorsed option on web.dev

Getting Started

1. Install the plugin:

npm install -D @scullyio/scully-plugin-critical-css

2. Use the plugin:

Then add it to your scully.<projectname>.config.ts like this:

import { criticalCSS } from '@scullyio/scully-plugin-critical-css';

/** the seoHrefOptimise is optional **/
const defaultPostRenderers = ['seoHrefOptimise', criticalCSS];

export const config: ScullyConfig = {
  /** more config here */
  defaultPostRenderers,
  /** more config here */
  routes: {
    /** more config here */
  },
};

The above config will use the plugin on all routes. If you want to use in on a single route, add it to the config of that particular route like this:

export const config: ScullyConfig = {
  /** more config here */
  routes: {
    someRoute: {
      type: 'contentFolder', // Or any other type
      postRenderers: = [criticalCSS],
    },
     /** more route configs here */
  }
}

Settings

You can configure this plugin by using the setPluginConfig helper like this:

setPluginConfig(criticalCSS, {
  inlineImages: false,
});

The plugin had the following settings:

export interface CriticalCSSSettings {
  /** inline images into the pages when smaller then 10240 bytes */
  inlineImages?: boolean;
  /** Width of the target viewport */
  width?: number;
  /** Height of the target viewport */
  height?: number;
  /** An array of objects containing height and width. Takes precedence over width and height if set */
  dimensions?: {
    width: number;
    height: number;
  }[];
  /** An array with fully qualified paths to assets, if none is given, the root, and the root/assets will be used to look for static assets*/
  assets?: string[];
  /** Ignore some css rules */
  ignore?: {
    atrule?: string[];
    rule?: string[];
    decl?: (node, value) => boolean;
  };
}

For details see the critical tool page

3.1.0-beta.0

10 months ago

2.1.41

2 years ago

2.1.36

2 years ago

2.1.32

2 years ago

2.1.29

2 years ago

2.1.28

2 years ago

2.1.26

2 years ago

3.0.0-beta.1

2 years ago

2.1.19

2 years ago

2.1.25

2 years ago

2.1.24

2 years ago

2.1.21

2 years ago

2.1.20

2 years ago

2.1.9

2 years ago

2.1.16

2 years ago

2.1.14

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.10

2 years ago

2.1.11

2 years ago

3.0.0-beta.0

2 years ago

2.1.18

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.5

2 years ago

2.1.8

2 years ago

2.1.0

2 years ago

1.0.1-BETA.55609

2 years ago

1.0.1-BETA.94902

2 years ago

1.0.1-BETA.94105

2 years ago

1.0.1-BETA.84818

2 years ago

1.0.1-BETA.80451

2 years ago

1.0.0-BETA.33130

2 years ago

1.0.1

2 years ago

1.0.0-BETA.63423

2 years ago

1.0.1-BETA.92113

2 years ago

1.0.1-BETA.95848

2 years ago

1.0.1-BETA.92613

2 years ago

1.0.1-BETA.60859

2 years ago

1.0.0-BETA.70529

2 years ago

1.0.1-BETA.64704

2 years ago

1.0.0-BETA.73219

3 years ago

1.0.0-BETA.62933

3 years ago

1.0.0-BETA.54936

3 years ago

1.0.0-BETA.91017

3 years ago

1.0.0-BETA.80110

3 years ago

1.0.0-BETA.84430

3 years ago

1.0.0-BETA.72406

3 years ago

1.0.0

3 years ago

1.0.0-BETA.60231

3 years ago

1.0.0-BETA.71202

3 years ago

1.0.0-BETA.70300

3 years ago

1.0.0-BETA.72556

3 years ago

1.0.0-BETA.63716

3 years ago

1.0.0-BETA.91341

3 years ago

0.1.1-BETA.44311

3 years ago

0.1.1-BETA.62759

3 years ago

0.1.1-BETA.94934

3 years ago

0.1.1-BETA.92551

3 years ago

0.1.1-BETA.83816

3 years ago

0.1.1-BETA.80335

3 years ago

0.1.1-BETA.81429

3 years ago

0.1.1-BETA.92614

3 years ago

0.1.1-BETA.81321

3 years ago

0.1.1-BETA.85725

3 years ago

0.1.1-BETA.74622

3 years ago

0.1.1-BETA.70116

3 years ago

0.1.1-BETA.72956

3 years ago

0.1.1-BETA.74556

3 years ago

0.1.1-BETA.65756

3 years ago

0.1.1-BETA.73135

3 years ago

0.1.1-BETA.71002

3 years ago

0.1.1-BETA.70346

3 years ago

0.1.1-BETA.63419

3 years ago

0.1.1-BETA.65336

3 years ago

0.1.1-BETA.63028

3 years ago

0.1.1-BETA.60027

3 years ago

0.1.1-BETA.62854

3 years ago

0.1.1-BETA.61837

3 years ago

0.1.1-BETA.61716

3 years ago

0.1.1-BETA.55746

3 years ago

0.1.1-BETA.94615

3 years ago

0.1.1-BETA.85130

3 years ago

0.1.1-BETA.83250

3 years ago

0.1.1-BETA.81821

3 years ago

0.1.1

3 years ago

0.1.0-BETA.82744

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.0.3-BETA.93934

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago