Skip to content

Commit

Permalink
Merge views subtree
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 11, 2023
2 parents 32d7e7b + f0dba0d commit 92275e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions template/pages/@/sections/inc/banner.ejs
@@ -1,12 +1,15 @@
<%
if (opt.img) {
const { width, height } = _.tryImageSize(opt.img)
const { width, height } = _.tryImageSize(opt.img, opt)
const sources = [{ src: opt.img }]
if (opt.mobile_img) {
sources[0].media = '(min-width: 576px)'
const { width, height } = _.tryImageSize(opt.mobile_img)
sources.push({
src: opt.mobile_img,
media: '(min-width: 100px)'
media: '(min-width: 100px)',
width,
height
})
}
sources.forEach(source => {
Expand Down Expand Up @@ -39,13 +42,17 @@ if (opt.img) {
data-height="<%= height %>"
<% } %>
>
<% sources.forEach(({ src, media, type }) => { %>
<% sources.forEach(({ src, media, type, width, height }) => { %>
<source
srcset="<%= src %>"
media="<%- media %>"
<% if (type) { %>
type="<%- type %>"
<% } %>
<% if (width) { %>
width="<%= width %>"
height="<%= height %>"
<% } %>
>
<% }) %>
<% if (opt.sync_load) { %>
Expand Down
4 changes: 2 additions & 2 deletions template/pages/@/sections/stamps.ejs
@@ -1,7 +1,7 @@
<% if (Array.isArray(opt.stamps)) { %>
<ul class="stamps">
<% opt.stamps.forEach(({ src, alt, link }) => {
const { width, height } = _.tryImageSize(src)
<% opt.stamps.forEach(({ src, alt, link, ...dimensions }) => {
const { width, height } = _.tryImageSize(src, dimensions)
const imgHtml = `<img data-src="${src}" alt="${alt}" class="lozad fade"` +
(width ? ` data-preload width="${width}" height="${height}">` : '>')
%>
Expand Down

0 comments on commit 92275e8

Please sign in to comment.