PHPackages                             amadeco/magento2-critical-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. amadeco/magento2-critical-css

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

amadeco/magento2-critical-css
=============================

Magento 2 module to automatically generate critical css with the addyosmani/critical npm package

v2.3.3(4mo ago)07MITPHP

Since Feb 16Pushed 4mo agoCompare

[ Source](https://github.com/Amadeco/magento2-critical-css)[ Packagist](https://packagist.org/packages/amadeco/magento2-critical-css)[ RSS](/packages/amadeco-magento2-critical-css/feed)WikiDiscussions master Synced today

READMEChangelog (4)DependenciesVersions (5)Used By (0)

M2Boilerplate Critical CSS
==========================

[](#m2boilerplate-critical-css)

Magento 2 module to automatically generate critical css with [critical](https://github.com/addyosmani/critical)

Features:
---------

[](#features)

- generate critical css with a simple command
- Fallback critical css for "empty" pages
- Add urls by creating a custom provider

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

[](#installation)

Install the critical binary. Install instructions can be found on the [critical website](https://github.com/addyosmani/critical#install). Only versions &gt;=2.0.3 are supported.

Add this extension to your Magento installation with Composer:

```
composer require m2-boilerplate/module-critical-css

```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

The critical css feature needs to be enabled (available in 2.3.4+):

```
bin/magento config:set dev/css/use_css_critical_path 1

```

Features can be customised in *Stores &gt; Configuration &gt; Developer &gt; CSS*.

### Generate critical css

[](#generate-critical-css)

Run the following command

```
bin/magento m2bp:critical-css:generate

```

Afterwards you should find the the generated css in `var/critical-css`. The css will now be integrated automatically on your website.

Add additional URLs via a custom provider
-----------------------------------------

[](#add-additional-urls-via-a-custom-provider)

The following example adds the magento contact page via a custom provider:

```
