Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ленивая загрузка картинок с цветным превью #4532

Merged
merged 11 commits into from
Dec 12, 2023

Conversation

prorokky
Copy link
Contributor

@prorokky prorokky commented Jun 27, 2023

Описание

Добавлена статья, в которой описан процесс добавления цветного превью для картинок, если они загружаются в "ленивом" режиме

Closes #2739

Превью: https://content-4532.dev.doka.guide/recipes/lazy-load-with-preview/

Чек-лист

  • Текст оформлен согласно руководству по стилю
  • Ссылки на внутренние материалы начинаются со слеша и заканчиваются слэшем либо якорем на заголовок (/css/color/, /tools/json/, /tools/gulp/#kak-ponyat)
  • Ссылки на картинки, видео и демки относительные (images/example.png, demos/example/, ../demos/example/)

@github-actions github-actions bot added дока Справочный материал рецепт Контент для Рецептов labels Jun 27, 2023
@prorokky prorokky force-pushed the doka/lazy-load-with-preview branch 2 times, most recently from ae957e7 to 044efe2 Compare June 27, 2023 19:42
@TatianaFokina TatianaFokina added the holyJS Статьи с HolyJS label Jun 28, 2023
@github-actions github-actions bot added the статья Расширенный материал label Jul 3, 2023
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
@TatianaFokina TatianaFokina removed the дока Справочный материал label Jul 3, 2023
Copy link
Member

@TatianaFokina TatianaFokina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спасибо за рецепт и милого котика в демке, кстати ❤️

recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
@skorobaeus
Copy link
Member

skorobaeus commented Jul 5, 2023

Привет! Спасибо большое за рецепт!

В демке минимум элементов, поэтому и стилей нужен минимум. Можно их просто перечислить :)

  • Для <body> задай, пожалуйста, фоновый цвет #18191C;
  • Для картинки — цвет #C56FFF;
  • Выровняй картинку по центру страницы по вертикали и по горизонтали любым удобным тебе способом, гридами или флексами.

И ещё нужно положить котика в репо рядом с демкой в папку images:

lazy-load/
  images/
    lazy-cat.jpg
  index.html

Мы стараемся не полагаться на сторонние сервисы и хостинги.

@prorokky prorokky force-pushed the doka/lazy-load-with-preview branch from d69cbd5 to f30987e Compare July 17, 2023 20:09
@prorokky prorokky force-pushed the doka/lazy-load-with-preview branch from f30987e to 1e4cc90 Compare July 17, 2023 20:16
Copy link
Member

@HellSquirrel HellSquirrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prorokky приветик! Большое спасибо за рецепт.
Я бы предложила его немного расширить и дополнить. Будет круто, если ты сделаешь это самостоятельно, но если будет слишком сложно - тегни меня и я тебе помогу

  1. Давай добавим картинке размеры и объясним зачем это сделано. (чтобы избежать LCP)
  2. Давай добавим информацию о browser hints, которые помогут еще гибче управлять загрузкой картинки (посмотри в сторону атрибута fetch-priority)
  3. Давай уточним случаи, когда не нужно использовать lazy loading через атрибут (не нужно когда картинка гарантированно сразу во вьюпорте)
  4. Давай добавим более интересное превью чем просто цветной фон. Тут много интересных вариантов. В идеале бы перечислить несколько. Например
  • progressive images - которые позволют подгрузить сначала превьюшку низкого качества
  • явное создание картинки-превью низкого разрешения. По аналогии с тем что делает next/image

Copy link
Member

@solarrust solarrust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оставила немного редакторских правок =)

recipes/lazy-load-with-preview/demos/lazy-load/index.html Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
@TatianaFokina
Copy link
Member

@HellSquirrel, @solarrust, загляните сюда?

recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
recipes/lazy-load-with-preview/index.md Outdated Show resolved Hide resolved
Copy link
Member

@solarrust solarrust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Большое спасибо за рецепт! Получилось отлично =)

Copy link

Превью контента из 510f77f опубликовано.

@solarrust solarrust merged commit 61c7720 into doka-guide:main Dec 12, 2023
7 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
holyJS Статьи с HolyJS рецепт Контент для Рецептов статья Расширенный материал
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ленивая загрузка картинок с цветными превью
5 participants