core-maugli 1.2.32 → 1.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -5
- package/package.json +18 -4
- package/public/blackbox-1200.webp +0 -0
- package/public/blackbox-400.webp +0 -0
- package/public/blackbox-800.webp +0 -0
- package/public/blackbox.webp +0 -0
- package/scripts/optimize-images.cjs +171 -0
- package/scripts/setup-user-images.js +75 -0
- package/scripts/squoosh-optimize.js +146 -0
- package/src/components/Card.astro +45 -1
- package/public/img/default/autor_default-1200.webp +0 -0
- package/public/img/default/autor_default-400.webp +0 -0
- package/public/img/default/autor_default-800.webp +0 -0
- package/public/img/default/autor_default.webp +0 -0
- package/public/img/default/blog_default-1200.webp +0 -0
- package/public/img/default/blog_default-400.webp +0 -0
- package/public/img/default/blog_default-800.webp +0 -0
- package/public/img/default/blog_default.webp +0 -0
- package/public/img/default/default-1200.webp +0 -0
- package/public/img/default/default-400.webp +0 -0
- package/public/img/default/default-800.webp +0 -0
- package/public/img/default/default.webp +0 -0
- package/public/img/default/previews/autor_default-1200.webp +0 -0
- package/public/img/default/previews/autor_default-400.webp +0 -0
- package/public/img/default/previews/autor_default-800.webp +0 -0
- package/public/img/default/previews/autor_default.webp +0 -0
- package/public/img/default/previews/blog_default-1200.webp +0 -0
- package/public/img/default/previews/blog_default-400.webp +0 -0
- package/public/img/default/previews/blog_default-800.webp +0 -0
- package/public/img/default/previews/blog_default.webp +0 -0
- package/public/img/default/previews/default-1200.webp +0 -0
- package/public/img/default/previews/default-400.webp +0 -0
- package/public/img/default/previews/default-800.webp +0 -0
- package/public/img/default/previews/default.webp +0 -0
- package/public/img/default/previews/product_default-1200.webp +0 -0
- package/public/img/default/previews/product_default-400.webp +0 -0
- package/public/img/default/previews/product_default-800.webp +0 -0
- package/public/img/default/previews/product_default.webp +0 -0
- package/public/img/default/previews/project_default-1200.webp +0 -0
- package/public/img/default/previews/project_default-400.webp +0 -0
- package/public/img/default/previews/project_default-800.webp +0 -0
- package/public/img/default/previews/project_default.webp +0 -0
- package/public/img/default/previews/rubric_default-1200.webp +0 -0
- package/public/img/default/previews/rubric_default-400.webp +0 -0
- package/public/img/default/previews/rubric_default-800.webp +0 -0
- package/public/img/default/previews/rubric_default.webp +0 -0
- package/public/img/default/previews/test-1200.webp +0 -0
- package/public/img/default/previews/test-400.webp +0 -0
- package/public/img/default/previews/test-800.webp +0 -0
- package/public/img/default/previews/test.webp +0 -0
- package/public/img/default/previews/test2-1200.webp +0 -0
- package/public/img/default/previews/test2-400.webp +0 -0
- package/public/img/default/previews/test2-800.webp +0 -0
- package/public/img/default/previews/test2.webp +0 -0
- package/public/img/default/product_default-1200.webp +0 -0
- package/public/img/default/product_default-400.webp +0 -0
- package/public/img/default/product_default-800.webp +0 -0
- package/public/img/default/product_default.webp +0 -0
- package/public/img/default/project_default-1200.webp +0 -0
- package/public/img/default/project_default-400.webp +0 -0
- package/public/img/default/project_default-800.webp +0 -0
- package/public/img/default/project_default.webp +0 -0
- package/public/img/default/rubric_default-1200.webp +0 -0
- package/public/img/default/rubric_default-400.webp +0 -0
- package/public/img/default/rubric_default-800.webp +0 -0
- package/public/img/default/rubric_default.webp +0 -0
- package/public/img/default/test-1200.webp +0 -0
- package/public/img/default/test-400.webp +0 -0
- package/public/img/default/test-800.webp +0 -0
- package/public/img/default/test.webp +0 -0
- package/public/img/default/test2-1200.webp +0 -0
- package/public/img/default/test2-400.webp +0 -0
- package/public/img/default/test2-800.webp +0 -0
- package/public/img/default/test2.webp +0 -0
- package/public/img/examples/authors/anna-1200.webp +0 -0
- package/public/img/examples/authors/anna-400.webp +0 -0
- package/public/img/examples/authors/anna-800.webp +0 -0
- package/public/img/examples/authors/anna.webp +0 -0
- package/public/img/examples/authors/carlos-1200.webp +0 -0
- package/public/img/examples/authors/carlos-400.webp +0 -0
- package/public/img/examples/authors/carlos-800.webp +0 -0
- package/public/img/examples/authors/carlos.webp +0 -0
- package/public/img/examples/authors/daria-1200.webp +0 -0
- package/public/img/examples/authors/daria-400.webp +0 -0
- package/public/img/examples/authors/daria-800.webp +0 -0
- package/public/img/examples/authors/daria.webp +0 -0
- package/public/img/examples/authors/dmitry-1200.webp +0 -0
- package/public/img/examples/authors/dmitry-400.webp +0 -0
- package/public/img/examples/authors/dmitry-800.webp +0 -0
- package/public/img/examples/authors/dmitry.webp +0 -0
- package/public/img/examples/authors/igor-1200.webp +0 -0
- package/public/img/examples/authors/igor-400.webp +0 -0
- package/public/img/examples/authors/igor-800.webp +0 -0
- package/public/img/examples/authors/igor.webp +0 -0
- package/public/img/examples/authors/john-1200.webp +0 -0
- package/public/img/examples/authors/john-400.webp +0 -0
- package/public/img/examples/authors/john-800.webp +0 -0
- package/public/img/examples/authors/john.webp +0 -0
- package/public/img/examples/blog/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-1200.webp +0 -0
- package/public/img/examples/blog/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-400.webp +0 -0
- package/public/img/examples/blog/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-800.webp +0 -0
- package/public/img/examples/blog/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva.webp +0 -0
- package/public/img/examples/blog/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-1200.webp +0 -0
- package/public/img/examples/blog/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-400.webp +0 -0
- package/public/img/examples/blog/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-800.webp +0 -0
- package/public/img/examples/blog/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese.webp +0 -0
- package/public/img/examples/blog/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-1200.webp +0 -0
- package/public/img/examples/blog/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-400.webp +0 -0
- package/public/img/examples/blog/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-800.webp +0 -0
- package/public/img/examples/blog/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik.webp +0 -0
- package/public/img/examples/blog/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-1200.webp +0 -0
- package/public/img/examples/blog/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-400.webp +0 -0
- package/public/img/examples/blog/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-800.webp +0 -0
- package/public/img/examples/blog/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte.webp +0 -0
- package/public/img/examples/blog/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-1200.webp +0 -0
- package/public/img/examples/blog/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-400.webp +0 -0
- package/public/img/examples/blog/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-800.webp +0 -0
- package/public/img/examples/blog/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya.webp +0 -0
- package/public/img/examples/blog/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-1200.webp +0 -0
- package/public/img/examples/blog/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-400.webp +0 -0
- package/public/img/examples/blog/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-800.webp +0 -0
- package/public/img/examples/blog/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga.webp +0 -0
- package/public/img/examples/blog/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-1200.webp +0 -0
- package/public/img/examples/blog/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-400.webp +0 -0
- package/public/img/examples/blog/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-800.webp +0 -0
- package/public/img/examples/blog/post-agent-experience-mcp-biznes-v-epohu-ii-agentov.webp +0 -0
- package/public/img/examples/blog/post_11-1200.webp +0 -0
- package/public/img/examples/blog/post_11-400.webp +0 -0
- package/public/img/examples/blog/post_11-800.webp +0 -0
- package/public/img/examples/blog/post_11.webp +0 -0
- package/public/img/examples/blog/post_12-1200.webp +0 -0
- package/public/img/examples/blog/post_12-400.webp +0 -0
- package/public/img/examples/blog/post_12-800.webp +0 -0
- package/public/img/examples/blog/post_12.webp +0 -0
- package/public/img/examples/blog/post_1_jsonld_guide-1200.webp +0 -0
- package/public/img/examples/blog/post_1_jsonld_guide-400.webp +0 -0
- package/public/img/examples/blog/post_1_jsonld_guide-800.webp +0 -0
- package/public/img/examples/blog/post_1_jsonld_guide.webp +0 -0
- package/public/img/examples/blog/previews/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-400.webp +0 -0
- package/public/img/examples/blog/previews/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva-800.webp +0 -0
- package/public/img/examples/blog/previews/post-1-avtomatizaciya-marketinga-kak-ii-osvobozhdaet-predprinimatelei-ot-cifrovogo-rabstva.webp +0 -0
- package/public/img/examples/blog/previews/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-400.webp +0 -0
- package/public/img/examples/blog/previews/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese-800.webp +0 -0
- package/public/img/examples/blog/previews/post-2-avtomatizaciya-kontenta-kak-neiroseti-ubivayut-perfekcionizm-v-biznese.webp +0 -0
- package/public/img/examples/blog/previews/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-400.webp +0 -0
- package/public/img/examples/blog/previews/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik-800.webp +0 -0
- package/public/img/examples/blog/previews/post-3-laik-ne-valyuta-kak-avtomatizaciya-marketinga-spasaet-ot-lozhnyh-metrik.webp +0 -0
- package/public/img/examples/blog/previews/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-400.webp +0 -0
- package/public/img/examples/blog/previews/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte-800.webp +0 -0
- package/public/img/examples/blog/previews/post-5-5-fatalnyh-oshibok-marketinga-kotorye-ubivayut-startapy-na-starte.webp +0 -0
- package/public/img/examples/blog/previews/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-400.webp +0 -0
- package/public/img/examples/blog/previews/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya-800.webp +0 -0
- package/public/img/examples/blog/previews/post-6-5-strategii-kontent-marketinga-dlya-startapov-avtomatizaciya-i-revolyuciya.webp +0 -0
- package/public/img/examples/blog/previews/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-400.webp +0 -0
- package/public/img/examples/blog/previews/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga-800.webp +0 -0
- package/public/img/examples/blog/previews/post-7-viralnyi-kontent-ne-udacha-a-strategiya-avtomatizaciya-marketinga.webp +0 -0
- package/public/img/examples/blog/previews/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-1200.webp +0 -0
- package/public/img/examples/blog/previews/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-400.webp +0 -0
- package/public/img/examples/blog/previews/post-agent-experience-mcp-biznes-v-epohu-ii-agentov-800.webp +0 -0
- package/public/img/examples/blog/previews/post-agent-experience-mcp-biznes-v-epohu-ii-agentov.webp +0 -0
- package/public/img/examples/blog/previews/post_11-1200.webp +0 -0
- package/public/img/examples/blog/previews/post_11-400.webp +0 -0
- package/public/img/examples/blog/previews/post_11-800.webp +0 -0
- package/public/img/examples/blog/previews/post_11.webp +0 -0
- package/public/img/examples/blog/previews/post_12-1200.webp +0 -0
- package/public/img/examples/blog/previews/post_12-400.webp +0 -0
- package/public/img/examples/blog/previews/post_12-800.webp +0 -0
- package/public/img/examples/blog/previews/post_12.webp +0 -0
- package/public/img/examples/blog/previews/post_1_jsonld_guide-1200.webp +0 -0
- package/public/img/examples/blog/previews/post_1_jsonld_guide-400.webp +0 -0
- package/public/img/examples/blog/previews/post_1_jsonld_guide-800.webp +0 -0
- package/public/img/examples/blog/previews/post_1_jsonld_guide.webp +0 -0
- package/public/img/examples/blog/previews/test-post-1200.webp +0 -0
- package/public/img/examples/blog/previews/test-post-400.webp +0 -0
- package/public/img/examples/blog/previews/test-post-800.webp +0 -0
- package/public/img/examples/blog/previews/test-post.webp +0 -0
- package/public/img/examples/blog/previews/tr-post-1.webp +0 -0
- package/public/img/examples/blog/test-post-1200.webp +0 -0
- package/public/img/examples/blog/test-post-400.webp +0 -0
- package/public/img/examples/blog/test-post-800.webp +0 -0
- package/public/img/examples/blog/test-post.webp +0 -0
- package/public/img/examples/blog/tr-post-1.webp +0 -0
- package/public/img/examples/products/previews/product_1-1200.webp +0 -0
- package/public/img/examples/products/previews/product_1-400.webp +0 -0
- package/public/img/examples/products/previews/product_1-800.webp +0 -0
- package/public/img/examples/products/previews/product_1.webp +0 -0
- package/public/img/examples/products/previews/product_2-1200.webp +0 -0
- package/public/img/examples/products/previews/product_2-400.webp +0 -0
- package/public/img/examples/products/previews/product_2-800.webp +0 -0
- package/public/img/examples/products/previews/product_2.webp +0 -0
- package/public/img/examples/products/product_1-1200.webp +0 -0
- package/public/img/examples/products/product_1-400.webp +0 -0
- package/public/img/examples/products/product_1-800.webp +0 -0
- package/public/img/examples/products/product_1.webp +0 -0
- package/public/img/examples/products/product_2-1200.webp +0 -0
- package/public/img/examples/products/product_2-400.webp +0 -0
- package/public/img/examples/products/product_2-800.webp +0 -0
- package/public/img/examples/products/product_2.webp +0 -0
- package/public/img/examples/projects/previews/project_1-1200.webp +0 -0
- package/public/img/examples/projects/previews/project_1-400.webp +0 -0
- package/public/img/examples/projects/previews/project_1-800.webp +0 -0
- package/public/img/examples/projects/previews/project_1.webp +0 -0
- package/public/img/examples/projects/previews/project_2-1200.webp +0 -0
- package/public/img/examples/projects/previews/project_2-400.webp +0 -0
- package/public/img/examples/projects/previews/project_2-800.webp +0 -0
- package/public/img/examples/projects/previews/project_2.webp +0 -0
- package/public/img/examples/projects/project_1-1200.webp +0 -0
- package/public/img/examples/projects/project_1-400.webp +0 -0
- package/public/img/examples/projects/project_1-800.webp +0 -0
- package/public/img/examples/projects/project_1.webp +0 -0
- package/public/img/examples/projects/project_2-1200.webp +0 -0
- package/public/img/examples/projects/project_2-400.webp +0 -0
- package/public/img/examples/projects/project_2-800.webp +0 -0
- package/public/img/examples/projects/project_2.webp +0 -0
- package/public/img/page-images/blog_default-1200.webp +0 -0
- package/public/img/page-images/blog_default-400.webp +0 -0
- package/public/img/page-images/blog_default-800.webp +0 -0
- package/public/img/page-images/blog_default.webp +0 -0
package/README.md
CHANGED
@@ -87,18 +87,119 @@ Your blog will be available at `http://localhost:4321/`
|
|
87
87
|
npm run build
|
88
88
|
```
|
89
89
|
|
90
|
+
## 🖼️ Image Management
|
91
|
+
|
92
|
+
Maugli Blog uses a **smart image management system** that separates user content from system assets:
|
93
|
+
|
94
|
+
### Your Images Are Protected ✅
|
95
|
+
|
96
|
+
During npm updates, **your images are preserved**:
|
97
|
+
|
98
|
+
- `public/img/blog/` - Your blog post images
|
99
|
+
- `public/img/authors/` - Your author photos
|
100
|
+
- `public/img/uploads/` - Your uploaded content
|
101
|
+
- `public/img/products/` - Your product images
|
102
|
+
- `public/img/projects/` - Your project images
|
103
|
+
|
104
|
+
### System Assets Are Updated 🔄
|
105
|
+
|
106
|
+
These are managed automatically by npm updates:
|
107
|
+
|
108
|
+
- `public/favicon.svg`, logos, icons
|
109
|
+
- `public/flags/` - Country flags
|
110
|
+
- `public/img/default/` - Default fallback images
|
111
|
+
|
112
|
+
### Automatic Image Optimization
|
113
|
+
|
114
|
+
The system includes **advanced image optimization** for maximum Lighthouse performance:
|
115
|
+
|
116
|
+
```bash
|
117
|
+
# Standard build with optimization:
|
118
|
+
npm run build
|
119
|
+
|
120
|
+
# Quick build without optimization:
|
121
|
+
npm run build:fast
|
122
|
+
|
123
|
+
# Manual optimization:
|
124
|
+
npm run optimize
|
125
|
+
```
|
126
|
+
|
127
|
+
**Automatic processing:**
|
128
|
+
|
129
|
+
```bash
|
130
|
+
# From: my-post.webp
|
131
|
+
# Creates: my-post-400.webp (mobile, optimized)
|
132
|
+
# my-post-800.webp (tablet, optimized)
|
133
|
+
# my-post-1200.webp (desktop, optimized)
|
134
|
+
# previews/my-post.webp (thumbnail)
|
135
|
+
```
|
136
|
+
|
137
|
+
**Optimization benefits:**
|
138
|
+
|
139
|
+
- ✅ **10-30% file size reduction** with no quality loss
|
140
|
+
- ✅ **WebP format optimization** (quality 80, max compression)
|
141
|
+
- ✅ **Progressive JPEG** for faster loading
|
142
|
+
- ✅ **Lighthouse performance boost**
|
143
|
+
- ✅ **Proper responsive images** with srcset
|
144
|
+
|
145
|
+
**Best practices:**
|
146
|
+
|
147
|
+
- Use WebP format for better performance
|
148
|
+
- Blog images: max 1200px width
|
149
|
+
- Author avatars: 400x400px recommended
|
150
|
+
|
151
|
+
See [detailed image optimization guide](docs/IMAGE-OPTIMIZATION.md) and [image management guide](docs/USER-IMAGES.md) for more information.
|
152
|
+
|
90
153
|
## Component Updates & Customization
|
91
154
|
|
92
|
-
|
155
|
+
⸻
|
156
|
+
|
157
|
+
**Important**: Maugli Blog is designed for centralized component updates. All core components (`src/components/`, `src/layouts/`, `src/pages/`, etc.) are automatically updated to the latest version when you run:
|
158
|
+
|
159
|
+
```bash
|
160
|
+
npm install --save core-maugli@latest
|
161
|
+
```
|
162
|
+
|
163
|
+
This ensures that you always receive the latest:
|
164
|
+
|
165
|
+
- **Features**
|
166
|
+
- **Bug fixes**
|
167
|
+
- **Performance improvements**
|
168
|
+
- **Accessibility enhancements**
|
169
|
+
- **Lighthouse-validated optimizations**
|
170
|
+
|
171
|
+
### Why Centralized Updates?
|
172
|
+
|
173
|
+
**1. Automation First**
|
174
|
+
Manual component maintenance is time-consuming and error-prone. Centralized updates free you from technical debt, allowing you to focus on content creation and business growth instead of code maintenance.
|
175
|
+
|
176
|
+
**2. Lighthouse & Performance Excellence**
|
177
|
+
All Maugli components are crafted to comply with strict Lighthouse, Web Vitals, and AI-indexability guidelines. Every component update includes:
|
178
|
+
|
179
|
+
- **Mobile UX optimization** (48px touch targets, responsive design)
|
180
|
+
- **Performance optimization** (proper image loading, minimal layout shift)
|
181
|
+
- **SEO compliance** (structured data, semantic HTML, accessibility)
|
182
|
+
- **Core Web Vitals** (LCP, FID, CLS optimization)
|
183
|
+
|
184
|
+
Manual changes may negatively affect your site's score in:
|
185
|
+
|
186
|
+
- **SEO**
|
187
|
+
- **Performance**
|
188
|
+
- **Accessibility**
|
189
|
+
- **Best Practices**
|
190
|
+
|
191
|
+
⚠️ **We do not recommend editing core components manually.** If you do, re-test your site with Lighthouse and search engine validators after every change.
|
192
|
+
|
193
|
+
⸻
|
93
194
|
|
94
195
|
This centralized update approach **does not affect**:
|
95
196
|
|
96
197
|
- Your content (`src/content/`)
|
97
|
-
- Your
|
98
|
-
- Your
|
99
|
-
- Your project
|
198
|
+
- Your configuration (`src/config/maugli.config.ts`)
|
199
|
+
- Your styles (`src/styles/global.css`) — preserved if customized
|
200
|
+
- Your project files (`package.json`, `astro.config.mjs`, etc.)
|
100
201
|
|
101
|
-
|
202
|
+
⸻
|
102
203
|
|
103
204
|
`npm run build` runs [`scripts/verify-assets.js`](scripts/verify-assets.js)
|
104
205
|
before the Astro build. This script checks the SHA-256 hashes of the
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "core-maugli",
|
3
3
|
"description": "Astro & Tailwind CSS blog theme for Maugli.",
|
4
4
|
"type": "module",
|
5
|
-
"version": "1.2.
|
5
|
+
"version": "1.2.34",
|
6
6
|
"license": "GPL-3.0-or-later OR Commercial",
|
7
7
|
"repository": {
|
8
8
|
"type": "git",
|
@@ -22,7 +22,10 @@
|
|
22
22
|
"dev": "node resize-all.cjs && node scripts/generate-previews.js && astro dev",
|
23
23
|
"prestart": "node resize-all.cjs && node scripts/generate-previews.js",
|
24
24
|
"start": "astro dev",
|
25
|
-
"build": "node
|
25
|
+
"build": "node scripts/optimize-images.cjs && node typograf-batch.js && node scripts/verify-assets.js && node scripts/generate-previews.js && astro build",
|
26
|
+
"build:fast": "node resize-all.cjs && node typograf-batch.js && node scripts/verify-assets.js && node scripts/generate-previews.js && astro build",
|
27
|
+
"optimize": "node scripts/optimize-images.cjs",
|
28
|
+
"optimize:squoosh": "node scripts/squoosh-optimize.js",
|
26
29
|
"test": "node tests/examplesFilter.test.ts",
|
27
30
|
"astro": "astro",
|
28
31
|
"featured:add": "node scripts/featured.js add",
|
@@ -31,7 +34,7 @@
|
|
31
34
|
"upgrade": "node scripts/upgrade-config.js",
|
32
35
|
"update-components": "node scripts/update-components.js",
|
33
36
|
"backup-update": "node scripts/update-with-backup.js",
|
34
|
-
"postinstall": "node scripts/upgrade-config.js",
|
37
|
+
"postinstall": "node scripts/upgrade-config.js && node scripts/setup-user-images.js",
|
35
38
|
"generate-previews": "node scripts/generate-previews.js"
|
36
39
|
},
|
37
40
|
"dependencies": {
|
@@ -55,6 +58,7 @@
|
|
55
58
|
"typograf": "^7.4.4"
|
56
59
|
},
|
57
60
|
"devDependencies": {
|
61
|
+
"@squoosh/cli": "^0.7.1",
|
58
62
|
"@tailwindcss/typography": "^0.5.16",
|
59
63
|
"prettier": "^3.5.3",
|
60
64
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
@@ -63,7 +67,17 @@
|
|
63
67
|
},
|
64
68
|
"files": [
|
65
69
|
"src",
|
66
|
-
"public",
|
70
|
+
"public/favicon.svg",
|
71
|
+
"public/icon-192.png",
|
72
|
+
"public/icon-512.png",
|
73
|
+
"public/manifest.webmanifest",
|
74
|
+
"public/logo-icon.svg",
|
75
|
+
"public/logoblog-icon.svg",
|
76
|
+
"public/maugli_for_animation.svg",
|
77
|
+
"public/mauglilabel.svg",
|
78
|
+
"public/footerlabel.svg",
|
79
|
+
"public/flags/",
|
80
|
+
"public/blackbox*.webp",
|
67
81
|
"scripts",
|
68
82
|
"bin"
|
69
83
|
],
|
Binary file
|
package/public/blackbox-400.webp
CHANGED
Binary file
|
package/public/blackbox-800.webp
CHANGED
Binary file
|
package/public/blackbox.webp
CHANGED
Binary file
|
@@ -0,0 +1,171 @@
|
|
1
|
+
// optimize-images.cjs - продвинутая оптимизация изображений с Sharp
|
2
|
+
const fs = require('fs');
|
3
|
+
const path = require('path');
|
4
|
+
const sharp = require('sharp');
|
5
|
+
|
6
|
+
// Размеры для генерации
|
7
|
+
const sizes = [400, 800, 1200];
|
8
|
+
|
9
|
+
// Настройки оптимизации для разных форматов
|
10
|
+
const optimizationSettings = {
|
11
|
+
webp: {
|
12
|
+
quality: 80,
|
13
|
+
effort: 6, // Максимальное сжатие (0-6)
|
14
|
+
lossless: false
|
15
|
+
},
|
16
|
+
jpeg: {
|
17
|
+
quality: 85,
|
18
|
+
progressive: true,
|
19
|
+
mozjpeg: true
|
20
|
+
},
|
21
|
+
png: {
|
22
|
+
quality: 90,
|
23
|
+
compressionLevel: 9, // Максимальное сжатие
|
24
|
+
progressive: true
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
const inputDir = './public';
|
29
|
+
const processedFiles = new Set();
|
30
|
+
|
31
|
+
// Функция для оптимизации изображения
|
32
|
+
async function optimizeImage(inputPath, outputPath, width = null) {
|
33
|
+
try {
|
34
|
+
const ext = path.extname(outputPath).toLowerCase();
|
35
|
+
let sharpInstance = sharp(inputPath);
|
36
|
+
|
37
|
+
// Ресайз если указана ширина
|
38
|
+
if (width) {
|
39
|
+
sharpInstance = sharpInstance.resize(width, null, {
|
40
|
+
withoutEnlargement: true,
|
41
|
+
fit: 'inside'
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
// Применяем оптимизацию в зависимости от формата
|
46
|
+
switch (ext) {
|
47
|
+
case '.webp':
|
48
|
+
await sharpInstance
|
49
|
+
.webp(optimizationSettings.webp)
|
50
|
+
.toFile(outputPath);
|
51
|
+
break;
|
52
|
+
|
53
|
+
case '.jpg':
|
54
|
+
case '.jpeg':
|
55
|
+
await sharpInstance
|
56
|
+
.jpeg(optimizationSettings.jpeg)
|
57
|
+
.toFile(outputPath);
|
58
|
+
break;
|
59
|
+
|
60
|
+
case '.png':
|
61
|
+
await sharpInstance
|
62
|
+
.png(optimizationSettings.png)
|
63
|
+
.toFile(outputPath);
|
64
|
+
break;
|
65
|
+
|
66
|
+
default:
|
67
|
+
// Для других форматов используем WebP по умолчанию
|
68
|
+
const webpPath = outputPath.replace(/\.[^.]+$/, '.webp');
|
69
|
+
await sharpInstance
|
70
|
+
.webp(optimizationSettings.webp)
|
71
|
+
.toFile(webpPath);
|
72
|
+
console.log(`🔄 Конвертирован в WebP: ${path.relative('./public', webpPath)}`);
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
|
76
|
+
console.log(`✅ Оптимизирован: ${path.relative('./public', outputPath)}`);
|
77
|
+
|
78
|
+
} catch (err) {
|
79
|
+
console.error(`❌ Ошибка оптимизации ${outputPath}:`, err.message);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
// Получение статистики размера файла
|
84
|
+
function getFileSizeStats(originalPath, optimizedPath) {
|
85
|
+
if (!fs.existsSync(originalPath) || !fs.existsSync(optimizedPath)) {
|
86
|
+
return null;
|
87
|
+
}
|
88
|
+
|
89
|
+
const originalSize = fs.statSync(originalPath).size;
|
90
|
+
const optimizedSize = fs.statSync(optimizedPath).size;
|
91
|
+
const savings = originalSize - optimizedSize;
|
92
|
+
const savingsPercent = Math.round((savings / originalSize) * 100);
|
93
|
+
|
94
|
+
return {
|
95
|
+
original: Math.round(originalSize / 1024),
|
96
|
+
optimized: Math.round(optimizedSize / 1024),
|
97
|
+
savings: Math.round(savings / 1024),
|
98
|
+
savingsPercent
|
99
|
+
};
|
100
|
+
}
|
101
|
+
|
102
|
+
// Рекурсивная функция для обхода папок
|
103
|
+
async function processDirectory(dir) {
|
104
|
+
if (!fs.existsSync(dir)) {
|
105
|
+
console.log(`📁 Папка ${dir} не существует`);
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
|
109
|
+
const items = fs.readdirSync(dir);
|
110
|
+
|
111
|
+
for (const item of items) {
|
112
|
+
const itemPath = path.join(dir, item);
|
113
|
+
const stat = fs.statSync(itemPath);
|
114
|
+
|
115
|
+
if (stat.isDirectory()) {
|
116
|
+
// Рекурсивно обрабатываем подпапки
|
117
|
+
await processDirectory(itemPath);
|
118
|
+
} else if (stat.isFile()) {
|
119
|
+
const ext = path.extname(item).toLowerCase();
|
120
|
+
const baseName = path.basename(item, ext);
|
121
|
+
|
122
|
+
// Проверяем, что это изображение и не содержит размер в названии
|
123
|
+
if (['.jpg', '.jpeg', '.png', '.webp'].includes(ext)) {
|
124
|
+
// Пропускаем файлы, которые уже содержат размер (например, image-400.webp)
|
125
|
+
if (!/-\d+$/.test(baseName) && !processedFiles.has(itemPath)) {
|
126
|
+
processedFiles.add(itemPath);
|
127
|
+
|
128
|
+
console.log(`🔄 Обрабатываем: ${itemPath}`);
|
129
|
+
|
130
|
+
// Сначала оптимизируем оригинал
|
131
|
+
const optimizedOriginal = path.join(path.dirname(itemPath), `${baseName}_optimized${ext}`);
|
132
|
+
await optimizeImage(itemPath, optimizedOriginal);
|
133
|
+
|
134
|
+
// Заменяем оригинал оптимизированной версией
|
135
|
+
if (fs.existsSync(optimizedOriginal)) {
|
136
|
+
const stats = getFileSizeStats(itemPath, optimizedOriginal);
|
137
|
+
if (stats && stats.savings > 0) {
|
138
|
+
fs.renameSync(optimizedOriginal, itemPath);
|
139
|
+
console.log(`💾 Экономия: ${stats.savings}KB (${stats.savingsPercent}%) - ${itemPath}`);
|
140
|
+
} else {
|
141
|
+
fs.unlinkSync(optimizedOriginal);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
// Создаем ресайзы
|
146
|
+
for (const width of sizes) {
|
147
|
+
const outputPath = path.join(path.dirname(itemPath), `${baseName}-${width}${ext}`);
|
148
|
+
await optimizeImage(itemPath, outputPath, width);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
async function main() {
|
157
|
+
console.log('🚀 Начинаем оптимизацию изображений с Sharp...');
|
158
|
+
console.log('⚙️ Настройки оптимизации:');
|
159
|
+
console.log(' WebP: качество 80, максимальное сжатие');
|
160
|
+
console.log(' JPEG: качество 85, прогрессивная загрузка');
|
161
|
+
console.log(' PNG: качество 90, максимальное сжатие');
|
162
|
+
console.log('');
|
163
|
+
|
164
|
+
await processDirectory(inputDir);
|
165
|
+
|
166
|
+
console.log('');
|
167
|
+
console.log('✅ Оптимизация завершена!');
|
168
|
+
console.log('📊 Все изображения оптимизированы для максимальной производительности');
|
169
|
+
}
|
170
|
+
|
171
|
+
main().catch(console.error);
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Image Management Script for Maugli Blog
|
5
|
+
* Handles user images separately from core system assets
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { existsSync, mkdirSync } from 'fs';
|
9
|
+
import { dirname, join } from 'path';
|
10
|
+
import { fileURLToPath } from 'url';
|
11
|
+
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
13
|
+
const __dirname = dirname(__filename);
|
14
|
+
|
15
|
+
const PUBLIC_DIR = join(__dirname, '..', 'public');
|
16
|
+
const IMG_DIR = join(PUBLIC_DIR, 'img');
|
17
|
+
|
18
|
+
// Ensure user image directories exist
|
19
|
+
function ensureUserDirectories() {
|
20
|
+
const userDirs = [
|
21
|
+
join(IMG_DIR, 'uploads'),
|
22
|
+
join(IMG_DIR, 'blog'),
|
23
|
+
join(IMG_DIR, 'authors'),
|
24
|
+
join(IMG_DIR, 'products'),
|
25
|
+
join(IMG_DIR, 'projects'),
|
26
|
+
join(IMG_DIR, 'previews'),
|
27
|
+
];
|
28
|
+
|
29
|
+
userDirs.forEach(dir => {
|
30
|
+
if (!existsSync(dir)) {
|
31
|
+
mkdirSync(dir, { recursive: true });
|
32
|
+
console.log(`✅ Created directory: ${dir}`);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
// Copy default images if they don't exist
|
38
|
+
function ensureDefaultImages() {
|
39
|
+
const defaultDir = join(IMG_DIR, 'default');
|
40
|
+
if (!existsSync(defaultDir)) {
|
41
|
+
mkdirSync(defaultDir, { recursive: true });
|
42
|
+
console.log(`✅ Created default images directory`);
|
43
|
+
}
|
44
|
+
|
45
|
+
// Create placeholder default images if needed
|
46
|
+
const defaultImages = [
|
47
|
+
'autor_default.webp',
|
48
|
+
'blog_default.webp',
|
49
|
+
'product_default.webp',
|
50
|
+
'project_default.webp'
|
51
|
+
];
|
52
|
+
|
53
|
+
// Note: In real implementation, we'd copy actual default images
|
54
|
+
console.log(`📁 Default images directory ready at: ${defaultDir}`);
|
55
|
+
}
|
56
|
+
|
57
|
+
// Main setup function
|
58
|
+
function setupUserImages() {
|
59
|
+
console.log('🖼️ Setting up user image directories...');
|
60
|
+
|
61
|
+
ensureUserDirectories();
|
62
|
+
ensureDefaultImages();
|
63
|
+
|
64
|
+
console.log('✅ User image setup complete!');
|
65
|
+
console.log('');
|
66
|
+
console.log('📝 User images are preserved during npm updates');
|
67
|
+
console.log('🔧 Core system assets are managed by the npm package');
|
68
|
+
}
|
69
|
+
|
70
|
+
// Run if called directly
|
71
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
72
|
+
setupUserImages();
|
73
|
+
}
|
74
|
+
|
75
|
+
export { setupUserImages };
|
@@ -0,0 +1,146 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
// squoosh-optimize.js - автоматическая оптимизация через Squoosh CLI
|
4
|
+
import { execSync } from 'child_process';
|
5
|
+
import fs from 'fs';
|
6
|
+
import path from 'path';
|
7
|
+
import { fileURLToPath } from 'url';
|
8
|
+
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
10
|
+
const __dirname = path.dirname(__filename);
|
11
|
+
|
12
|
+
const projectRoot = path.resolve(__dirname, '..');
|
13
|
+
const publicDir = path.join(projectRoot, 'public');
|
14
|
+
|
15
|
+
// Функция для получения всех изображений
|
16
|
+
function getAllImages(dir, images = []) {
|
17
|
+
const items = fs.readdirSync(dir);
|
18
|
+
|
19
|
+
for (const item of items) {
|
20
|
+
const itemPath = path.join(dir, item);
|
21
|
+
const stat = fs.statSync(itemPath);
|
22
|
+
|
23
|
+
if (stat.isDirectory()) {
|
24
|
+
getAllImages(itemPath, images);
|
25
|
+
} else if (stat.isFile()) {
|
26
|
+
const ext = path.extname(item).toLowerCase();
|
27
|
+
if (['.jpg', '.jpeg', '.png', '.webp'].includes(ext)) {
|
28
|
+
// Пропускаем уже обработанные ресайзы
|
29
|
+
const baseName = path.basename(item, ext);
|
30
|
+
if (!/-\d+$/.test(baseName)) {
|
31
|
+
images.push(itemPath);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return images;
|
38
|
+
}
|
39
|
+
|
40
|
+
// Функция для создания временной директории
|
41
|
+
function createTempDir() {
|
42
|
+
const tempDir = path.join(projectRoot, '.temp-optimization');
|
43
|
+
if (!fs.existsSync(tempDir)) {
|
44
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
45
|
+
}
|
46
|
+
return tempDir;
|
47
|
+
}
|
48
|
+
|
49
|
+
// Функция для оптимизации через Squoosh CLI
|
50
|
+
async function optimizeWithSquoosh() {
|
51
|
+
console.log('🚀 Начинаем оптимизацию через Squoosh CLI...');
|
52
|
+
|
53
|
+
const images = getAllImages(publicDir);
|
54
|
+
console.log(`📁 Найдено ${images.length} изображений для оптимизации`);
|
55
|
+
|
56
|
+
if (images.length === 0) {
|
57
|
+
console.log('📷 Нет изображений для оптимизации');
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
|
61
|
+
const tempDir = createTempDir();
|
62
|
+
|
63
|
+
try {
|
64
|
+
// Создаем директорию для входных файлов
|
65
|
+
const inputDir = path.join(tempDir, 'input');
|
66
|
+
const outputDir = path.join(tempDir, 'output');
|
67
|
+
|
68
|
+
if (!fs.existsSync(inputDir)) fs.mkdirSync(inputDir, { recursive: true });
|
69
|
+
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
|
70
|
+
|
71
|
+
// Копируем файлы во временную директорию
|
72
|
+
console.log('📋 Подготавливаем файлы...');
|
73
|
+
images.forEach((imagePath, index) => {
|
74
|
+
const ext = path.extname(imagePath);
|
75
|
+
const tempFileName = `image_${index}${ext}`;
|
76
|
+
const tempFilePath = path.join(inputDir, tempFileName);
|
77
|
+
fs.copyFileSync(imagePath, tempFilePath);
|
78
|
+
});
|
79
|
+
|
80
|
+
// Запускаем Squoosh CLI для WebP оптимизации
|
81
|
+
console.log('⚡ Запускаем Squoosh CLI...');
|
82
|
+
const squooshCommand = `npx @squoosh/cli --webp auto "${inputDir}/*" -d "${outputDir}"`;
|
83
|
+
|
84
|
+
try {
|
85
|
+
execSync(squooshCommand, {
|
86
|
+
stdio: 'inherit',
|
87
|
+
cwd: projectRoot
|
88
|
+
});
|
89
|
+
|
90
|
+
console.log('✅ Squoosh CLI завершен');
|
91
|
+
|
92
|
+
// Копируем оптимизированные файлы обратно
|
93
|
+
const optimizedFiles = fs.readdirSync(outputDir);
|
94
|
+
let totalSavings = 0;
|
95
|
+
let processedCount = 0;
|
96
|
+
|
97
|
+
optimizedFiles.forEach((fileName, index) => {
|
98
|
+
if (index < images.length) {
|
99
|
+
const originalPath = images[index];
|
100
|
+
const optimizedPath = path.join(outputDir, fileName);
|
101
|
+
|
102
|
+
if (fs.existsSync(optimizedPath)) {
|
103
|
+
const originalSize = fs.statSync(originalPath).size;
|
104
|
+
const optimizedSize = fs.statSync(optimizedPath).size;
|
105
|
+
|
106
|
+
if (optimizedSize < originalSize) {
|
107
|
+
const savings = originalSize - optimizedSize;
|
108
|
+
const savingsPercent = Math.round((savings / originalSize) * 100);
|
109
|
+
|
110
|
+
// Заменяем оригинал на оптимизированную версию
|
111
|
+
fs.copyFileSync(optimizedPath, originalPath);
|
112
|
+
|
113
|
+
totalSavings += savings;
|
114
|
+
processedCount++;
|
115
|
+
|
116
|
+
console.log(`💾 ${path.relative(publicDir, originalPath)}: ${Math.round(savings/1024)}KB экономии (${savingsPercent}%)`);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
});
|
121
|
+
|
122
|
+
console.log(`\n🎉 Обработано ${processedCount} изображений`);
|
123
|
+
console.log(`💰 Общая экономия: ${Math.round(totalSavings/1024)}KB`);
|
124
|
+
|
125
|
+
} catch (squooshError) {
|
126
|
+
console.error('❌ Ошибка Squoosh CLI:', squooshError.message);
|
127
|
+
console.log('🔄 Переключаемся на Sharp оптимизацию...');
|
128
|
+
return false;
|
129
|
+
}
|
130
|
+
|
131
|
+
} finally {
|
132
|
+
// Очищаем временные файлы
|
133
|
+
if (fs.existsSync(tempDir)) {
|
134
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
return true;
|
139
|
+
}
|
140
|
+
|
141
|
+
// Запуск если вызван напрямую
|
142
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
143
|
+
optimizeWithSquoosh().catch(console.error);
|
144
|
+
}
|
145
|
+
|
146
|
+
export { optimizeWithSquoosh };
|
@@ -1,7 +1,13 @@
|
|
1
1
|
---
|
2
|
+
import fs from 'fs';
|
3
|
+
import path from 'path';
|
4
|
+
import { fileURLToPath } from 'url';
|
2
5
|
import { maugliConfig } from '../config/maugli.config';
|
3
6
|
import FormattedDate from './FormattedDate.astro';
|
4
7
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
9
|
+
const projectRoot = path.resolve(path.dirname(__filename), '../..');
|
10
|
+
|
5
11
|
type Props = {
|
6
12
|
href: string;
|
7
13
|
title: string;
|
@@ -36,6 +42,42 @@ const cardImageAlt = seo?.image?.alt || image?.alt || title || 'Изображе
|
|
36
42
|
|
37
43
|
// Определяем контент для отображения
|
38
44
|
const content = excerpt || description;
|
45
|
+
|
46
|
+
// Функция для создания responsive изображений
|
47
|
+
function getResponsiveImages(imagePath: string) {
|
48
|
+
const basePath = imagePath.replace(/\.(webp|jpg|jpeg|png)$/i, '');
|
49
|
+
const extension = imagePath.match(/\.(webp|jpg|jpeg|png)$/i)?.[0] || '.webp';
|
50
|
+
|
51
|
+
const variants = [
|
52
|
+
{ suffix: '-400', width: '400w' },
|
53
|
+
{ suffix: '-800', width: '800w' },
|
54
|
+
{ suffix: '-1200', width: '1200w' }
|
55
|
+
];
|
56
|
+
|
57
|
+
const srcsetItems = [];
|
58
|
+
|
59
|
+
// Добавляем адаптивные версии, если они существуют
|
60
|
+
for (const variant of variants) {
|
61
|
+
const variantPath = `${basePath}${variant.suffix}${extension}`;
|
62
|
+
const filePath = path.join(projectRoot, 'public', variantPath.replace(/^\//, ''));
|
63
|
+
|
64
|
+
if (fs.existsSync(filePath)) {
|
65
|
+
srcsetItems.push(`${variantPath} ${variant.width}`);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
// Всегда добавляем оригинальное изображение
|
70
|
+
srcsetItems.push(`${imagePath} 1200w`);
|
71
|
+
|
72
|
+
return {
|
73
|
+
src: imagePath,
|
74
|
+
srcset: srcsetItems.join(', '),
|
75
|
+
sizes: '(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 400px'
|
76
|
+
};
|
77
|
+
}
|
78
|
+
|
79
|
+
// Генерируем responsive изображения для карточки
|
80
|
+
const imageData = getResponsiveImages(baseImage);
|
39
81
|
---
|
40
82
|
|
41
83
|
<article
|
@@ -49,11 +91,13 @@ const content = excerpt || description;
|
|
49
91
|
<!-- Изображение -->
|
50
92
|
<div class="w-full aspect-[1200/630] bg-[var(--bg-muted)] overflow-hidden relative">
|
51
93
|
<img
|
52
|
-
src={
|
94
|
+
src={imageData.src}
|
53
95
|
alt={cardImageAlt}
|
54
96
|
loading="eager"
|
55
97
|
width="1200"
|
56
98
|
height="630"
|
99
|
+
srcset={imageData.srcset}
|
100
|
+
sizes={imageData.sizes}
|
57
101
|
class="w-full h-full object-cover rounded-custom transition-transform duration-300 group-hover:scale-105"
|
58
102
|
/>
|
59
103
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|