PHPackages                             gurucomkz/silverstripe-critical-path-css - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. gurucomkz/silverstripe-critical-path-css

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

gurucomkz/silverstripe-critical-path-css
========================================

Critical Path CSS compiler/cacher for SilverStripe

191PHP

Since Nov 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/gurucomkz/silverstripe-critical-path-css)[ Packagist](https://packagist.org/packages/gurucomkz/silverstripe-critical-path-css)[ RSS](/packages/gurucomkz-silverstripe-critical-path-css/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Critical path CSS generator for SilverStripe (EXPERIMENTAL)
===========================================================

[](#critical-path-css-generator-for-silverstripe-experimental)

Assists in producing the Critical path CSS for every page of the website, including that code and postponing every other css. Uses [penthouse](https://github.com/pocketjoso/penthouse) to generate the CSS.

How it works
------------

[](#how-it-works)

The module provides a dev task `GenerateCriticalPathCSS` that calls every Live page on the website, and processes the HTML with [penthouse](https://github.com/pocketjoso/penthouse), caches the resulting CSS, injects the latter into pages' during regular requests HTML and postpones all the already inlcluded local(!) CSS files using a special javascript snippet.

If you choose to involve external CSS files (see Configuration below) they will be downloaded and stored in cache.

### Limitations

[](#limitations)

- All the CSS files you want to involve must be included using `Requirements::css()` or `Requirements::themedCSS()`.
- Firefox doesn't seem to like the postponing of CSS files and will most likely not gain any real speed boost.

Requirements
------------

[](#requirements)

- `nodejs`
- `yarn` or `npm`

They are required to install `penthouse` after package installation.

Installation
------------

[](#installation)

Install via composer and do `?flush=1`.

```
composer require --prefer-dist gurucomkz/silverstripe-critical-path-css "dev-master"
```

Install required packages inside the package's directory with `yarn` or `npm`.

```
cd vendor/gurucomkz/silverstripe-critical-path-css
yarn || npm
```

Usage
-----

[](#usage)

This is intended to be run on the target server.

```
sake dev/tasks/GenerateCriticalPathCSS

```

This task may take a lot of time depending on amount of pages on the website and effort required to produce their HTML. Please, note that since this command is executed in CLI caches produced by your web server are not applicable.

Configuration
-------------

[](#configuration)

```
Gurucomkz\Critpath:
  # involve the external css files
  include_external: true # default: false
  # ensure these selectors are a part of the critical path CSS
  # see https://github.com/pocketjoso/penthouse#options for 'forceInclude'
  force_css_selectors:
    - ".abc"
    - "#another"
    - "/\\.slick.*/"
```

TODO
----

[](#todo)

- Unit tests

Contributing
------------

[](#contributing)

Please create an issue or a PR for any bugs you've found, or features you're missing.

Special thanks
--------------

[](#special-thanks)

- [Jonas Ohlsson Aden](https://github.com/pocketjoso) for [penthouse](https://github.com/pocketjoso/penthouse)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a57f110fa33aaaed9ae0b84b5ed8a82dcb7ded56123df5ca0d225b3206e5a484?d=identicon)[gurucomkz](/maintainers/gurucomkz)

---

Top Contributors

[![gurucomkz](https://avatars.githubusercontent.com/u/12028675?v=4)](https://github.com/gurucomkz "gurucomkz (12 commits)")

### Embed Badge

![Health badge](/badges/gurucomkz-silverstripe-critical-path-css/health.svg)

```
[![Health](https://phpackages.com/badges/gurucomkz-silverstripe-critical-path-css/health.svg)](https://phpackages.com/packages/gurucomkz-silverstripe-critical-path-css)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
