Skip to content

Commit

Permalink
fix(entry): improve init; fix test without info-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed May 13, 2022
1 parent 62305c9 commit 5731c7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion example/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<organism-page-header v-model="menuOpened" v-bind="pageHeader" />
<nuxt :inert="menuOpened" />
<info-layer critical />
<info-layer v-if="!disableInfoLayer" critical />
<github-corner />
<google-lighthouse />
</div>
Expand All @@ -22,6 +22,7 @@ export default {
data () {
return {
disableInfoLayer: String(process.env.DISABLE_INFO_LAYER).toLowerCase() === 'true',
menuOpened: false,
pageHeader: {
Expand Down
11 changes: 4 additions & 7 deletions lib/templates/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ if (!document.getElementById('nuxt-speedkit-layer')) {

setup(<%= options.performanceMetrics %>);

setupSpeedkitLayer(() => initApp(true), supportedBrowser)

if(('__NUXT_SPEEDKIT_AUTO_INIT__' in global && global.__NUXT_SPEEDKIT_AUTO_INIT__) || ((<%= !options.ignorePerformance %> && hasSufficientPerformance()) && supportedBrowser)) {
initApp();
}

observeSpeedkitButton('nuxt-speedkit-button-init-font', initFont);

if('__NUXT_SPEEDKIT_FONT_INIT__' in global && global.__NUXT_SPEEDKIT_FONT_INIT__) {
} else if('__NUXT_SPEEDKIT_FONT_INIT__' in global && global.__NUXT_SPEEDKIT_FONT_INIT__) {
initFont()
} else {
observeSpeedkitButton('nuxt-speedkit-button-init-font', initFont);
setupSpeedkitLayer(() => initApp(true), supportedBrowser)
}

}
5 changes: 4 additions & 1 deletion test/default.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const generate = async (buildDir, distDir) => {
target: 'static',
modern: true,
buildDir,
generate: { dir: distDir, crawler: false },
env: {
DISABLE_INFO_LAYER: true
},
generate: { cache: false, dir: distDir, crawler: false },
dir: {
pages: 'pages/tests'
}
Expand Down

0 comments on commit 5731c7f

Please sign in to comment.