4

How to enable CSS Critical Path in Magento 2.3.0

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

When I try to enable, I'm getting the below error. Magento v 2.3.0

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

2 Answers 2

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
    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
    Sep 9, 2019 at 14:42
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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