Repository navigation
Conversation
Sprockets apps that compress CSS with sassc (libsass) evaluate min() and max() as Sass functions, so Swagger UI's max-height:min(60vh,800px) fails assets:precompile with "Incompatible units: 'px' and 'vh'". CSS function names are case-insensitive but libsass function names are not, so the vendored stylesheet uses MIN()/MAX(), and swagger_ui:dist:update rewrites them on every Swagger UI update. A spec guards the vendored stylesheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Swagger UI Sass compatibility update.
No open issues 🎉
What changed in this PR
This PR addresses sassc compatibility for Swagger UI CSS in Sprockets applications by preventing Sass from evaluating CSS min() and max() functions with mixed units.
Changes:
- Updates the asset refresh task to uppercase
min()andmax()calls while preserving browser behavior. - Adds a regression spec that rejects lowercase calls in the vendored stylesheet.
- Documents the compatibility fix in the changelog.
| File | Description |
|---|---|
spec/assets/swagger_ui_css_spec.rb |
Checks the vendored CSS for lowercase min() and max() calls. |
lib/tasks/swagger_ui.rake |
Normalizes function names when importing Swagger UI CSS. |
CHANGELOG.md |
Records the sassc compatibility fix. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Swagger UI 5.33.0 added
.swagger-ui section.models .models-scroll{max-height:min(60vh,800px)}. Sprockets apps that compress CSS with sassc (libsass) readmin()andmax()as Sass functions, soassets:precompile, and any page that renders the asset, fails with:This has affected every release since 1.0.10.
CSS function names ignore case, but libsass function names don't. So:
swagger-ui.cssnow usesMIN(60vh,800px), which libsass leaves alone and browsers read the same way;swagger_ui:dist:updateupper-casesmin(/max(calls on every Swagger UI update, so the scheduled update job doesn't bring the problem back;spec/assets/swagger_ui_css_spec.rbfails if the vendored stylesheet contains a lower-casemin()/max()call.I checked it by compressing the fixed stylesheet with sassc 2.4.0 (
style: :compressed). It compiles, and the output keepsMIN(60vh, 800px).🤖 Generated with Claude Code