Skip to content

Commit 2e4fb25

Browse files
author
An Phan
committed
Lazyload the GitHub badges
1 parent e536da3 commit 2e4fb25

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

app/site/src/App.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
<script>
3737
import _ from 'lodash'
38+
import Blazy from 'blazy'
3839
import { event } from './utils'
3940
import group from './components/Group.vue'
4041
import explore from './components/Explore.vue'
@@ -72,6 +73,13 @@ export default {
7273
}
7374
},
7475
76+
mounted() {
77+
// Register lazyloading for the GitHub badges
78+
const blazy = new Blazy({
79+
container: '.right'
80+
})
81+
},
82+
7583
methods: {
7684
/**
7785
* Limit filtering using lodash's debounce.

app/site/src/components/Item.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<template v-else>{{ item.author.name }}</template>
99
</span>
1010
<a v-if="githubBadgeUrl" :href="item.url" class="github-badge">
11-
<img :src="githubBadgeUrl">
11+
<img class="b-lazy"
12+
src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
13+
:data-src="githubBadgeUrl">
1214
</a>
1315
</h1>
1416
<div class="thin" v-if="item.description" v-html="item.description"></div>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"babel-core": "^6.0.0",
1717
"babel-loader": "^6.0.0",
1818
"babel-preset-es2015": "^6.0.0",
19+
"blazy": "^1.6.2",
1920
"chalk": "^1.1.3",
2021
"copy-webpack-plugin": "^3.0.1",
2122
"cross-env": "^1.0.6",

0 commit comments

Comments
 (0)