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

website is too slow #37

Open
shayan0v0n opened this issue Feb 24, 2024 · 1 comment
Open

website is too slow #37

shayan0v0n opened this issue Feb 24, 2024 · 1 comment

Comments

@shayan0v0n
Copy link

I was waiting for website for load whole document about 2m

@MicLieg
Copy link

MicLieg commented Oct 27, 2024

I solved this issue by only loading the actual images from shields.io on hover of the <li> element and displaying a tiny gif as placeholder:

each icon in icons
          li.grid-item(
            style=`--order-color: ${icon.indexByColor}`,
            data-brand=`${icon.normalizedName}`,
            data-title=`${icon.title}`,
            data-encoded_title=`${icon.badgeEncodedTitle}`,
            data-color=`${icon.shortHex}`,
            data-logo_color=`${icon.superLight ? '000' : 'fff'}`,
            data-slug=`${icon.slug}`
          )
            .grid-item__row.mv-2.fg-2
              button.grid-item__preview.copy-button.copy-svg(
                title=`${icon.title} SVG`,
                data-style='for-the-badge',
                disabled
              )
                img.icon-preview(
                  src='data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
                  data-src=`https://img.shields.io/badge/${icon.badgeEncodedTitle}-${icon.shortHex}?logo=${icon.slug}&logoColor=${icon.superLight ? '000' : 'fff'}&style=for-the-badge`,
                  loading='lazy',
                  alt=`${icon.title} badge`
                )
            .grid-item__row
              if icon.guidelines
                a.grid-item__link.link-button(
                  title=`${icon.title} guidelines`,
                  href=icon.guidelines,
                  rel='noopener',
                  target='_blank'
                ) Brand Guidelines
              if icon.license
                a.grid-item__link.link-button.icon-legal(
                  title=`${icon.title} icon license`,
                  href=icon.license.url,
                  rel='noopener',
                  target='_blank'
                ) #{ icon.license.type }
              h2.grid-item__title #{ icon.title }
            .grid-item__footer
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Flat Badge`,
                data-style='flat',
                disabled
              ) Flat
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Square Badge`,
                data-style='flat-square',
                disabled
              ) Square
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Plastic Badge`,
                data-style='plastic',
                disabled
              ) Plastic

Of course, commenting out the <img> works too:

each icon in icons
          li.grid-item(
            style=`--order-color: ${icon.indexByColor}`,
            data-brand=`${icon.normalizedName}`,
            data-title=`${icon.title}`,
            data-encoded_title=`${icon.badgeEncodedTitle}`,
            data-color=`${icon.shortHex}`,
            data-logo_color=`${icon.superLight ? '000' : 'fff'}`,
            data-slug=`${icon.slug}`
          )
            .grid-item__row.mv-2.fg-2
              button.grid-item__preview.copy-button.copy-svg(
                title=`${icon.title} SVG`,
                data-style='for-the-badge',
                disabled
              )
                //img.icon-preview(
                //  src=`https://img.shields.io/badge/${icon.badgeEncodedTitle}-${icon.shortHex}?logo=${icon.slug}&logoColor=${icon.superLight ? '000' : 'fff'}&style=for-the-badge`,
                //  loading='eager',
                //  alt=`${icon.title} badge`
                //)
            .grid-item__row
              if icon.guidelines
                a.grid-item__link.link-button(
                  title=`${icon.title} guidelines`,
                  href=icon.guidelines,
                  rel='noopener',
                  target='_blank'
                ) Brand Guidelines
              if icon.license
                a.grid-item__link.link-button.icon-legal(
                  title=`${icon.title} icon license`,
                  href=icon.license.url,
                  rel='noopener',
                  target='_blank'
                ) #{ icon.license.type }
              h2.grid-item__title #{ icon.title }
            .grid-item__footer
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Flat Badge`,
                data-style='flat',
                disabled
              ) Flat
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Square Badge`,
                data-style='flat-square',
                disabled
              ) Square
              button.grid-item__color.copy-button.copy-color(
                title=`${icon.title} Plastic Badge`,
                data-style='plastic',
                disabled
              ) Plastic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants