mirror of
https://github.com/GuerillaStudio/vanillalist.git
synced 2024-12-21 08:31:55 +00:00
Optimize images
This commit is contained in:
parent
2a415686f4
commit
18f9492662
3 changed files with 18 additions and 5 deletions
|
@ -13,7 +13,16 @@ module.exports = function (plugin) {
|
|||
return `
|
||||
<div class="plugin">
|
||||
<a class="plugin__visual" href="${visualLink}?ref=vanillalist" target="_blank" rel="noopener">
|
||||
<img srcset="${plugin.image} 1x, ${plugin.image2x} 2x" alt="${plugin.title}" width="308" height="195">
|
||||
<picture>
|
||||
<source
|
||||
media="(max-width: 559px)"
|
||||
srcset="${plugin.image92} 1x,
|
||||
${plugin.image184} 2x">
|
||||
<img
|
||||
src="${plugin.image308}" alt="${plugin.title}"
|
||||
srcset="${plugin.image616} 2x"
|
||||
width="308" height="195">
|
||||
</picture>
|
||||
</a>
|
||||
<h2 class="plugin__name">${plugin.title}</h2>
|
||||
<p class="plugin__about">${plugin.description}</p>
|
||||
|
|
|
@ -9,8 +9,10 @@ class Main {
|
|||
const list = (await Promise.all(data.collections.plugins.map(async plugin => {
|
||||
return {
|
||||
...plugin,
|
||||
image: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 425, height: 270 }))),
|
||||
image2x: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 616, height: 390 })))
|
||||
image92: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 92, height: 58 }))),
|
||||
image184: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 184, height: 116 }))),
|
||||
image308: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 308, height: 195 }))),
|
||||
image616: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 616, height: 390 })))
|
||||
}
|
||||
})));
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@ class Main {
|
|||
const list = (await Promise.all(data.plugins.map(async plugin => {
|
||||
return card({
|
||||
...plugin,
|
||||
image: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 308, height: 195 }))),
|
||||
image2x: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 616, height: 390 })))
|
||||
image92: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 92, height: 58 }))),
|
||||
image184: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 184, height: 116 }))),
|
||||
image308: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 308, height: 195 }))),
|
||||
image616: await this.getUrl(this.png(this.resize('./uploads/' + plugin.image, { width: 616, height: 390 })))
|
||||
})
|
||||
}))).join('');
|
||||
|
||||
|
|
Loading…
Reference in a new issue