Skip to content

Commit 696069b

Browse files
authored
Merge pull request #132 from GrabarzUndPartner/feature/vue-lazy-hydration
Feature/vue lazy hydration
2 parents c31fb30 + 28c9496 commit 696069b

File tree

10 files changed

+288
-473
lines changed

10 files changed

+288
-473
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Project Changelog
22

3+
## [1.0.6](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v1.0.5...v1.0.6) (2021-01-22)
4+
5+
6+
### Bug Fixes
7+
8+
* **font:** fix font-weight safari ([0403352](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/0403352e34c004d8267639fcec0ef86454e22181))
9+
* **font:** fix weight normalize ([4b8ee08](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/4b8ee081f5df9f967ed1e09dfd0d178395eb202a))
10+
* **font:** weight normalize both values ([214bec4](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/214bec4993909face7bb9612b1ccb3d9644ae168))
11+
312
## [1.0.5](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v1.0.4...v1.0.5) (2021-01-16)
413

514

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# nuxt-speedkit
22

3+
![nuxt-speedkit][logo]
4+
35
[![Grabarz & Partner - Module][grabarz-partner-module-src]][grabarz-partner-href]
46

57
[![main][github-workflow-main-src]][github-workflow-main-href]
6-
[![dependencies status][dependencies-status-src]][dependencies-status-href]
7-
[![dev-dependencies status][dependencies-dev-status-src]][dependencies-dev-status-href]
8-
98
[![Sonarcloud Status][sonarcloud-src]][sonarcloud-href]
109

1110
[![npm version][npm-version-latest-src]][npm-version-latest-href]
@@ -357,7 +356,7 @@ or look here
357356
[MIT License](./LICENSE)
358357

359358
<!-- Badges -->
360-
359+
[logo]: https://repository-images.githubusercontent.com/265295866/7e292000-5cc1-11eb-8469-1aafbf1d2727 "nuxt-speedkit"
361360
[grabarz-partner-module-src]: <https://img.shields.io/badge/Grabarz%20&%20Partner-Module-d19700>
362361
[grabarz-partner-href]: <https://grabarzundpartner.de>
363362

example/pages/full-example-with-components.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
2424
const lazyImageWebp = require('@/assets/img/lazy-2400.jpg?resize&sizes[]=480,sizes[]=768,sizes[]=960,sizes[]=1080,sizes[]=1200,sizes[]=1536,sizes[]=2160,sizes[]=2400&placeholder&format=webp');
2525
const lazyImageJpeg = require('@/assets/img/lazy-2400.jpg?resize&sizes[]=480,sizes[]=768,sizes[]=960,sizes[]=1080,sizes[]=1200,sizes[]=1536,sizes[]=2160,sizes[]=2400&placeholder');
26-
const lazyPlaceholder = require('@/assets/img/lazy-2400.jpg?lqip');
26+
const lazyPlaceholder = require('@/assets/img/lazy-2400.jpg?sqip');
2727
2828
return {
2929
contentA: '<p>This is a basic test with single font variant.</p>',

example/pages/index.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ export default {
6161
title: 'Test: SpeedkitIframe',
6262
to: '/tests/speedkit-iframe'
6363
},
64-
{
65-
title: 'Test: Speedkit Function',
66-
to: '/tests/speedkit-function'
67-
},
6864
{
6965
title: 'Test: Component Import (Critical by Prop)',
7066
to: '/tests/component-import/critical-prop'

example/pages/tests/speedkit-function.vue

Lines changed: 0 additions & 54 deletions
This file was deleted.

lib/plugins/vFont/mixin.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// IMPORTANT: speedkitComponent must be equal projekt import
22
import FontCollection from 'nuxt-speedkit/classes/FontCollection';
3-
import speedkit, { MODE } from 'nuxt-speedkit/utils/speedkit';
3+
import { hydrateWhenVisible } from 'vue-lazy-hydration';
44

55
export default {
66
install (Vue) {
@@ -49,7 +49,7 @@ export default {
4949
.entries(this.$options.speedkitComponents || {})
5050
.reduce((result, [key, value]) => {
5151
return Object.assign(result, {
52-
[key]: speedkit(() => wrapComponent(value()), MODE.VISIBLE, {
52+
[key]: hydrateWhenVisible(value, {
5353
rootMargin: process.env.NUXT_SPEEDKIT_LAZY_OFFSET_COMPONENT || '0%'
5454
})
5555
});
@@ -59,18 +59,3 @@ export default {
5959
});
6060
}
6161
};
62-
63-
function wrapComponent (module) {
64-
return module.then((component) => {
65-
return {
66-
functional: true,
67-
render (h, context) {
68-
const componentData = context.data;
69-
componentData.attrs = Object.assign({}, componentData.attrs, context.props);
70-
return h(component.default || component, Object.assign({}, componentData));
71-
}
72-
};
73-
}).catch((err) => {
74-
throw err;
75-
});
76-
}

lib/utils/speedkit.js

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)