Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Introducing theme variables! CSS variables beginning with `--theme-` will adjust

* To come in follow up PR.

## Bug Fixes

* **css:** at2x mixin doesn't support single keyword values (#751)

## Migration Tips

See the [Migration Guide](https://protocol.mozilla.org/docs/usage/migration) for automated scripts (VS Code find/replace and terminal commands) to help with these changes.
Expand Down
11 changes: 7 additions & 4 deletions assets/sass/protocol/includes/mixins/_at2x.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
// example.png
// example-high-res.png
// Usage:
// @include at2x('/media/img/foo.png', 100px, 100px);
// @include at2x('/media/img/example.png', 100px, 100px);
// @include at2x('/media/img/example.jpg', auto, 200px);
// @include at2x('/media/img/example.avif', 25%);
// @include at2x('/media/img/example.webp', contain);

@mixin at2x($path, $w: auto, $h: auto) {
$hr-suffix: '-high-res';

// Do not set height to auto if width is contain
@if $w == 'contain' {
// Do not set height if `contain` or `cover` is passed as the first param
@if $w == 'contain' or $w == 'cover' {
$h: #{''};
}

Expand All @@ -28,7 +31,7 @@
// Loop through the image path and find the position of
// the dot to determine the file extension.
// Subtract from string length to make an end point that
// is always lower than the start point s the loop always
// is always lower than the start point so the loop always
// increments (10 is an arbitrary number).
@for $i from $length through $length - 10 {
@if $position == -1 {
Expand Down