Skip to content

Disable the CSS autoprefixer in the Storefront by default

Disable the CSS autoprefixer in the Storefront by default

INFO

This document represents an architecture decision record (ADR) and has been mirrored from the ADR section in our Shopware 6 repository. You can find the original version here

Context

The storefront CSS, compiled by scssphp/scssphp, is currently automatically prefixed with vendor prefixes using padaliyajay/php-autoprefixer. However, the generated prefixes no longer add much value since the browser support has been updated with the Bootstrap v5 update. Most of the prefixes are unnecessary for the supported browsers in .browserslist. Unfortunately, the theme:compile process experiences a significant decrease in performance due to the auto-prefixer, which is particularly problematic in our SaaS solution. Moreover, the padaliyajay/php-autoprefixer package does not work dynamically and fails to consider .browserslist while applying the appropriate vendor-prefixes. This package hard-codes the CSS properties that require prefixing, making it an unsustainable long-term solution. To demonstrate this, a table containing all automatic prefixes generated by padaliyajay/php-autoprefixer is provided below.

Current browser support

>= 0.5%
last 2 major versions
not dead
Chrome >= 60
Firefox >= 60
Firefox ESR
iOS >= 12
Safari >= 12
not Explorer <= 11

Current auto-prefixes

✅ = Fully covered by current browser support. The prefix is not used by the browser.
⚠️ = Not fully covered by current browser support. Please read the notes.

Current auto-prefixes for Webkit

CSS propertyVendor prefixSupportNotesCan I use
box-reflect-webkit-box-reflect⚠️ No Firefox supportNo cross-browser support was possible using prefixing onlyhttps://caniuse.com/?search=box-reflect
column-count-webkit-column-count✅ Full supporthttps://caniuse.com/?search=column-count
column-gap-webkit-column-gap✅ Full supporthttps://caniuse.com/?search=column-gap
column-rule-webkit-column-rule✅ Full supporthttps://caniuse.com/?search=column-rule
clip-path-webkit-clip-path⚠️ Partial supportPrefix was needed in Safari 7-13 and iOS 7-12.5https://caniuse.com/?search=clip-path
user-select-webkit-user-select✅ Full supporthttps://caniuse.com/?search=user-select
appearance-webkit-appearance✅ Full supporthttps://caniuse.com/?search=appearance
animation-webkit-animation✅ Full supporthttps://caniuse.com/?search=animation
transition-webkit-transition✅ Full supporthttps://caniuse.com/?search=transition
transform-webkit-transform✅ Full supporthttps://caniuse.com/?search=transform
transform-origin-webkit-transform-origin✅ Full supporthttps://caniuse.com/?search=transform-origin
backface-visibility-webkit-backface-visibility✅ Full supporthttps://caniuse.com/?search=backface-visibility
perspective-webkit-perspective✅ Full supporthttps://caniuse.com/?search=perspective
background-clip-webkit-background-clip⚠️ Partial supportValue "text" needs prefix. Non-standard method of clipping a background image to the foreground texthttps://caniuse.com/?search=background-clip
filter-webkit-filter✅ Full supporthttps://caniuse.com/?search=filter
font-feature-settings-webkit-font-feature-settings✅ Full supporthttps://caniuse.com/?search=font-feature-settings
flow-from-webkit-flow-from⚠️ No supportWas supported in WebKit and IE, implementing the feature is no longer being pursued by any browserhttps://caniuse.com/?search=flow-from
flow-into-webkit-flow-into⚠️ No supportWas supported in WebKit and IE, implementing the feature is no longer being pursued by any browserhttps://caniuse.com/?search=flow-into
hyphens-webkit-hyphens⚠️ Partial supportSafari and iOs need prefix. Value "auto" has full supporthttps://caniuse.com/?search=hyphens
mask-image-webkit-mask-image✅ Full supportPrefixed values for gradients (-webkit-linear-gradient) were needed. Later, support for unprefixed values was added.https://caniuse.com/?search=mask-image
mask-repeat-webkit-mask-repeat⚠️ Partial supportChrome and Edge need prefix.https://caniuse.com/?search=mask-repeat
mask-position-webkit-mask-position⚠️ Partial supportChrome and Edge need prefix.https://caniuse.com/?search=mask-position
mask-size-webkit-mask-size⚠️ Partial supportChrome and Edge need prefix.https://caniuse.com/?search=mask-size
display: flexdisplay: -webkit-flex✅ Full supporthttps://caniuse.com/?search=display%3A flex
display: inline-flexdisplay: -webkit-inline-flex✅ Full supporthttps://caniuse.com/?search=display%3A inline-flex
position: stickyposition: -webkit-sticky⚠️ Partial supportSafari 7.1 - 12.1 needed prefix. Afterwards full unprefixed supporthttps://caniuse.com/?search=display%3A inline-flex
::placeholder::-webkit-input-placeholder✅ Full supporthttps://caniuse.com/?search=%3A%3Aplaceholder
::file-selector-button::-webkit-file-upload-button✅ Full supporthttps://caniuse.com/?search=%3A%3Afile-selector-button
keyframes-webkit-keyframes✅ Full supporthttps://caniuse.com/?search=keyframes

Current auto-prefixes for Mozilla

CSS propertyVendor prefixSupportNotesCan I use
column-count-moz-column-count✅ Full supporthttps://caniuse.com/?search=column-count
column-gap-moz-column-gap✅ Full supporthttps://caniuse.com/?search=column-gap
column-rule-moz-column-rule✅ Full supporthttps://caniuse.com/?search=column-rule
user-select-moz-user-select✅ Full supporthttps://caniuse.com/?search=user-select
appearance-moz-appearance✅ Full supporthttps://caniuse.com/?search=appearance
font-feature-settings-moz-font-feature-settings✅ Full supporthttps://caniuse.com/?search=font-feature-settings
hyphens-moz-hyphens✅ Full supporthttps://caniuse.com/?search=hyphens
::placeholder::-moz-placeholder✅ Full supporthttps://caniuse.com/?search=placeholder
:placeholder-shown:-moz-placeholder-shown✅ Full supporthttps://caniuse.com/?search=%3Aplaceholder-shown

Decision

  • Due to the above points we have decided to disable the CSS auto-prefixing by default.
  • In case it is still needed, to support older browsers or some special CSS property from the table above, it can still be activated via the config key storefront.theme.auto_prefix_css in Storefront/Resources/config/packages/storefront.yaml. However, we recommend to do a manual prefix inside the SCSS instead.
  • We will deprecate the auto-prefixing for v6.6.0 and only use SCSS compiling
  • We do not consider the deactivation of the auto-prefixing as a hard breaking change because:
    • Most prefixes are not needed due to current browser support.
    • Some prefixes are for CSS properties which are no longer implemented and developed by browsers.
    • Prefixes which are still valid are primarily cosmetic/appearance properties which are very unlikely to affect the Storefronts functionality.

Consequences

When compiling the themes SCSS with theme:compile, the vendor-prefixes are no longer applied by default to the all.css.