2.1.41 • Published 2 years ago

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

Weekly downloads
205
License
-
Repository
github
Last release
2 years 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

2 years ago

2.1.41

3 years ago

2.1.36

3 years ago

2.1.32

3 years ago

2.1.29

3 years ago

2.1.28

3 years ago

2.1.26

3 years ago

3.0.0-beta.1

3 years ago

2.1.19

3 years ago

2.1.25

3 years ago

2.1.24

3 years ago

2.1.21

3 years ago

2.1.20

3 years ago

2.1.9

3 years ago

2.1.16

3 years ago

2.1.14

3 years ago

2.1.12

3 years ago

2.1.13

3 years ago

2.1.10

3 years ago

2.1.11

3 years ago

3.0.0-beta.0

3 years ago

2.1.18

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.5

3 years ago

2.1.8

3 years ago

2.1.0

3 years ago

1.0.1-BETA.55609

4 years ago

1.0.1-BETA.94902

4 years ago

1.0.1-BETA.94105

4 years ago

1.0.1-BETA.84818

4 years ago

1.0.1-BETA.80451

4 years ago

1.0.0-BETA.33130

4 years ago

1.0.1

4 years ago

1.0.0-BETA.63423

4 years ago

1.0.1-BETA.92113

4 years ago

1.0.1-BETA.95848

4 years ago

1.0.1-BETA.92613

4 years ago

1.0.1-BETA.60859

4 years ago

1.0.0-BETA.70529

4 years ago

1.0.1-BETA.64704

4 years ago

1.0.0-BETA.73219

4 years ago

1.0.0-BETA.62933

4 years ago

1.0.0-BETA.54936

4 years ago

1.0.0-BETA.91017

4 years ago

1.0.0-BETA.80110

4 years ago

1.0.0-BETA.84430

4 years ago

1.0.0-BETA.72406

4 years ago

1.0.0

4 years ago

1.0.0-BETA.60231

4 years ago

1.0.0-BETA.71202

4 years ago

1.0.0-BETA.70300

4 years ago

1.0.0-BETA.72556

4 years ago

1.0.0-BETA.63716

4 years ago

1.0.0-BETA.91341

4 years ago

0.1.1-BETA.44311

4 years ago

0.1.1-BETA.62759

4 years ago

0.1.1-BETA.94934

4 years ago

0.1.1-BETA.92551

4 years ago

0.1.1-BETA.83816

4 years ago

0.1.1-BETA.80335

4 years ago

0.1.1-BETA.81429

4 years ago

0.1.1-BETA.92614

4 years ago

0.1.1-BETA.81321

4 years ago

0.1.1-BETA.85725

4 years ago

0.1.1-BETA.74622

4 years ago

0.1.1-BETA.70116

4 years ago

0.1.1-BETA.72956

4 years ago

0.1.1-BETA.74556

4 years ago

0.1.1-BETA.65756

4 years ago

0.1.1-BETA.73135

4 years ago

0.1.1-BETA.71002

4 years ago

0.1.1-BETA.70346

4 years ago

0.1.1-BETA.63419

4 years ago

0.1.1-BETA.65336

4 years ago

0.1.1-BETA.63028

4 years ago

0.1.1-BETA.60027

4 years ago

0.1.1-BETA.62854

4 years ago

0.1.1-BETA.61837

4 years ago

0.1.1-BETA.61716

4 years ago

0.1.1-BETA.55746

4 years ago

0.1.1-BETA.94615

4 years ago

0.1.1-BETA.85130

4 years ago

0.1.1-BETA.83250

4 years ago

0.1.1-BETA.81821

4 years ago

0.1.1

4 years ago

0.1.0-BETA.82744

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.3-BETA.93934

4 years ago

0.0.2

5 years ago

0.0.1

5 years ago