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

Feat/docs performance optimizations #3316

Merged
merged 7 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions packages/docs/components/landing/StarsButton.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<template>
<client-only>
<va-button
:href="url"
size="small"
target="blank"
color="textPrimary"
class="stars-button"
>
<template #prepend>
<va-icon
name="star_empty"
size="small"
/>
</template>
{{ stars }}
</va-button>
</client-only>
<va-button
:href="url"
size="small"
target="blank"
color="textPrimary"
class="stars-button"
>
<template #prepend>
<va-icon
name="star_empty"
size="small"
/>
</template>
{{ stars }}
</va-button>
</template>

<script lang="ts">
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/modules/page-config/runtime/PageConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const props = defineProps({
required: true
}
})

if (props.pageConfig.head) {
useHead(props.pageConfig.head)
}
</script>

<template>
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/modules/page-config/runtime/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DefineComponent } from 'vue'
import { MetaObject } from '#head';
import example from '../blocks/example'
import title from '../blocks/title'
import paragraph from '../blocks/paragraph'
Expand Down Expand Up @@ -53,6 +54,8 @@ export type Block = ReturnType<GlobalBlock[keyof typeof block]>
export type ConcreteBlock<T extends string, B = Block> = B extends { type: T } ? B : never

export type PageConfigOptions = {
head?: MetaObject,
rustem-nasyrov marked this conversation as resolved.
Show resolved Hide resolved

meta?: {
title?: string;
// TODO: Add more
Expand Down
38 changes: 20 additions & 18 deletions packages/docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ export default defineNuxtConfig({
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'icon', type: 'image/png', href: '/favicon.png' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
{ rel: 'stylesheet', href: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700&display=swap" },
{ rel: 'stylesheet', href: "https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400&display=swap" },
{ rel: 'stylesheet', href: "https://fonts.googleapis.com/icon?family=Material+Icons&display=swap" },
{ rel: 'stylesheet', href: "https://fonts.googleapis.com/icon?family=Material+Icons+Outlined&display=swap" },
],

script: [
{ crossorigin: 'anonymous', src: 'https://kit.fontawesome.com/5460c87b2a.js' },
{ type: 'module', src: 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js' },
],

meta: [
Expand Down Expand Up @@ -76,21 +66,18 @@ export default defineNuxtConfig({
},
},

// TODO: hydration mismatch issues; tailwind doesn't work properly
// ssr: false,
// nitro: {
// prerender: {
// routes: ['/'],
// ignore: ['/*']
// }
// },
ssr: true,
nitro: {
compressPublicAssets: true,
},

modules: [
// './modules/banner',
'./modules/vuestic',
'./modules/page-config',
// "./modules/i18n",
// TODO: remove after i18n is released https://github.com/nuxt-modules/i18n/pull/1712
'@nuxtjs/google-fonts',
'@nuxtjs/i18n-edge',
'./modules/markdown',
'@nuxtjs/tailwindcss',
Expand All @@ -102,6 +89,21 @@ export default defineNuxtConfig({
fonts: false,
},

googleFonts: {
preload: true,
swap: true,
families: {
'Source+Sans+Pro': {
wght: [400, 600, 700],
},
'Source+Code+Pro': {
wght: [400],
},
'Material+Icons': true,
'Material+Icons+Outlined': true,
},
},

tailwindcss: {
config: {
content: [
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
},
"dependencies": {
"@docsearch/js": "^3.2.1",
"@nuxtjs/google-fonts": "^3.0.0-1",
"@types/acorn": "^6.0.0",
"acorn": "^8.8.1",
"codesandbox": "^2.2.3",
"highlight.js": "^11.7.0",
"markdown-it": "^12.3.2",
"markdown-it-attrs": "^4.0.0",
"highlight.js": "^11.7.0"
"markdown-it-attrs": "^4.0.0"
}
}
12 changes: 12 additions & 0 deletions packages/docs/page-config/services/icons-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ const tableData = [
];

export default definePageConfig({
head: {
link: [
{ rel: 'dns-prefetch', as: 'script', href: 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js' },
{ rel: 'dns-prefetch', as: 'script', href: 'https://kit.fontawesome.com/5460c87b2a.js' },
],

script: [
{ crossorigin: 'anonymous', src: 'https://kit.fontawesome.com/5460c87b2a.js' },
{ type: 'module', src: 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js' },
],
},

blocks: [
block.title("iconsConfig.title"),
block.paragraph("iconsConfig.about"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<va-badge overlap>
<template #text>
<va-icon
name="mdi-bell"
name="notifications"
size="12px"
/> 5+
</template>
Expand Down
12 changes: 12 additions & 0 deletions packages/docs/page-config/ui-elements/icon/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import apiOptions from "./api-options";

export default definePageConfig({
head: {
link: [
{ rel: 'dns-prefetch', as: 'script', href: 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js' },
{ rel: 'dns-prefetch', as: 'script', href: 'https://kit.fontawesome.com/5460c87b2a.js' },
],

script: [
{ crossorigin: 'anonymous', src: 'https://kit.fontawesome.com/5460c87b2a.js' },
{ type: 'module', src: 'https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js' },
],
},

blocks: [
block.title("icon.title"),
block.paragraph("icon.summaryText"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{ tab }}
</va-tab>
<va-tab
icon="fas-home"
icon="home"
label="Tab with icon"
name="icon"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{ title }}
</va-tab>
<va-tab
icon="fas-home"
icon="home"
label="Tab with icon"
name="icon"
/>
Expand Down
Loading