1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

refactor(core): optimize image loading

- JavaScript runs so fast that LQIP will never be detected
- Increase the running priority of image processing in posts

Enhancement for #1267
This commit is contained in:
Cotes Chung
2023-09-29 05:07:03 +08:00
parent b489da89ca
commit e3b01636ac
4 changed files with 56 additions and 24 deletions

View File

@@ -81,6 +81,7 @@
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
{% assign _attrs = _left | split: '" ' %}
{% assign _src = null %}
{% assign _lqip = null %}
{% assign _class = null %}
@@ -119,8 +120,9 @@
{% endunless %}
{% if _lqip %}
{% if _lqip contains ':' %}
{% if _lqip contains 'data:' %}
{% assign _lazyload = false %}
{% assign _class = _class | append: ' blur' %}
{% else %}
{% assign _lqip_alt = 'lqip="' | append: _path_prefix %}
{% assign _left = _left | replace: 'lqip="', _lqip_alt %}