refactor: use ~/ for alias and improve ssg

This commit is contained in:
Anthony Fu committed 2021-02-05 09:34:09 +08:00
1 parent 7074ca3704
commit 1799f56844
10 files changed
+30 -12

No files matched your search

+14
View File
@@ -1,3 +1,17 @@
<script setup lang="ts">
import { useHead } from '@vueuse/head'
// https://github.com/vueuse/head
// you can use this to manipulate the document head in any components,
// they will be renedered correctly in the html results with vite-ssg
useHead({
title: 'Vitesse',
meta: [
{ name: 'description', content: 'Opinionated Vite Starter Template' },
],
})
</script>
<template>
<main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
<router-view />
+1 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { isDark } from '/~/logics'
import { isDark } from '~/logics'
const { t, availableLocales, locale } = useI18n()
+1 -1
View File
@@ -3,7 +3,7 @@
A custom user module system. Place a `.ts` file with the following template, it will be installed automatically.
```ts
import { UserModule } from '/~/types'
import { UserModule } from '~/types'
export const install: UserModule = ({ app, router, isClient }) => {
// do something
+1 -1
View File
@@ -1,5 +1,5 @@
import { createI18n } from 'vue-i18n'
import { UserModule } from '/~/types'
import { UserModule } from '~/types'
// import i18n resources
// https://vitejs.dev/guide/features.html#glob-import
+1 -1
View File
@@ -1,5 +1,5 @@
import NProgress from 'nprogress'
import { UserModule } from '/~/types'
import { UserModule } from '~/types'
export const install: UserModule = ({ isClient, router }) => {
if (isClient) {
+2 -2
View File
@@ -5,7 +5,7 @@ Check out [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) f
### Path Aliasing
`/~/` is aliased to `./src/` folder.
`~/` is aliased to `./src/` folder.
For example, instead of having
@@ -16,5 +16,5 @@ import { isDark } from '../../../../logics'
now you can use
```ts
import { isDark } from '/~/logics'
import { isDark } from '~/logics'
```