Skip to content

I2I: Relax CSS Limit from 50000 bytes to 75000 bytes #26466

@kristoferbaxter

Description

@kristoferbaxter

Summary

Increase the allowed bytes for a valid AMP document from 50000 to 75000.

Design document

The change itself is quite straightforward, change max_bytes from 50000 to 75000 here.

css_length_spec: {
  html_format: AMP
  max_bytes: 50000
  max_bytes_per_inline_style: 1000
  spec_url: "https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml#maximum-size"
}

Motivation

Many web developers have encountered the existing limit of 50000 with even quite advanced CSS minification techniques.

AMP's goal with a limit is to encourage hygiene, not to reduce capabilities. Increasing the limit slightly will allow a larger set of documents to be considered valid AMP.

In tandem, we will explore a general CSS minification technique for all AMP documents to help achieve the hygiene goal (remove unused CSS) without sacrificing readability.

Alternatives Considered

Keep existing limit while creating a more general CSS minifier that can ensure a larger number of documents can meet the existing limit.

While this meets the goal of focusing on user-experience first, the risk is a smaller number of valid documents while teams and developers wait for this solution.

Implement a limit based on document complexity

Theoretically this would be a best of both worlds solution, allowing documents that need additional CSS size to use the space. However, the complexity of the solution requires additional consideration. Moving to 75000 bytes allows for this exploration to continue without causing document developers to wait for a potentially complex solution that is difficult to communicate and potentially easy to game.

Additional context

Work is beginning on a more general CSS minifier as part of the wg-outreach group. If you'd like to participate, please join in!

Launch tracker

https://docs.google.com/spreadsheets/d/1Aw7YeIHvPbuR8WFgciPodBMXdsmI3FZLsu8-iX0sPGk

/cc @ampproject/wg-approvers, @ampproject/wg-outreach, @ampproject/wg-performance, @ampproject/wg-caching

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions