5

How to enable CSS Critical Path in Magento 2.3?

Ref: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css-critical-path.html

When I try to enable it, I'm getting the below error.

The "dev/css/use_css_critical_path" path doesn't exist. Verify and try again.
2

3 Answers 3

5

This will probably be added in v2.3.3. This is the MR: https://github.com/magento/magento2/commit/fb9a02ae025d102744857f981b702c0fe32c23d2

2
  • 1
    It's weird how the documentation for this is already live and for 2.2 as well despite the files not being in 2.2 or 2.3 yet.
    – Ben Crook
    Commented Sep 9, 2019 at 13:15
  • 2
    This confused me as well and I was referred to the MR after asking around on the M2 Community Engineers Slack channel.
    – Victor F
    Commented Sep 9, 2019 at 14:42
2

You can enable it via admin panel Stores > Settings > Configuration > ADVANCED > Developer or via terminal.

Magento 2.4 critical css

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

How to use it

You can create a critical.css in your custom theme as the example below.

app/design/frontend/<your_vendor_name>/<your_theme_name>/web/css/critical.css

Reference: Magento 2.4 DevDocs - CSS critical path

0

Do you know how to disable it - return back to option "No". Is there CLI command or something else?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.