Skip to content

Critical CSS and $global-url path #177

@mercs600

Description

@mercs600

Summary
In OroCommerce 6.1, Critical CSS generation incorrectly resolves the $global-url variable, breaking font paths when using the official method for setting custom static fonts.

Steps to reproduce

  1. Follow the official guide to configure custom fonts using $theme-custom-fonts and $global-url:
    https://doc.oroinc.com/frontend/storefront/how-to/how-to-change-fonts/
  2. Add static font files under the custom theme and configure the map accordingly.
  3. Build assets.
  4. Inspect both regular CSS and Critical CSS outputs.

Actual Result

In regular CSS:
Font paths are generated correctly, e.g.
build/_static/bundles/customtheme/ThemeBundle/fonts/

In Critical CSS:
Font paths are incorrect, e.g.
_static/bundles/customtheme/ThemeBundle/fonts/
(missing build/ prefix, resulting in 404 errors)

What I tried:
Attempted to override $global-url specifically for Critical CSS context – no effect.

Expected Result
Font paths should be consistent and valid in both regular CSS and Critical CSS. The $global-url should resolve correctly in both contexts, especially since it’s used per official recommendations.

Additionally this change breaks the styleguide (https://doc.oroinc.com/frontend/storefront-style-guide/#download-figma-design-files) when it comes to default font. oroinc/platform@9ac1848#diff-b568627b1737580ca94f40965d8b945e354225f418ac041d9503fa39b1e4c8a3R12

Details about your environment

  • OroCommerce version: 6.1
  • PHP version: 8.4
  • Database (MySQL, PostgreSQL) version: postgres 17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions