style: adjust few code styles

pull/137/head
Kia King Ishii 5 years ago
parent ac43f05188
commit 360bd35c60

@ -2,11 +2,11 @@
<div class="theme">
<h1>404</h1>
<blockquote>{{ getMsg() }}</blockquote>
<a :href="$site.base" aria-label="go to home"> Take me home. </a>
<a :href="$site.base" aria-label="go to home">Take me home.</a>
</div>
</template>
<script setup>
<script setup lang="ts">
const msgs = [
`There's nothing here.`,
`How did we get here?`,
@ -14,7 +14,7 @@ const msgs = [
`Looks like we've got some broken links.`
]
function getMsg() {
const getMsg = () => {
return msgs[Math.floor(Math.random() * msgs.length)]
}
</script>

@ -20,6 +20,10 @@ import { withBase, isExternal } from '../utils'
import type { DefaultTheme } from '../config'
import OutboundLink from './icons/OutboundLink.vue'
const { item } = defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const normalizePath = (path: string): string => {
path = path
.replace(/#.*$/, '')
@ -31,10 +35,6 @@ const normalizePath = (path: string): string => {
return path
}
const { item } = defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const route = useRoute()
const classes = computed(() => ({

@ -18,8 +18,8 @@
</template>
<script setup lang="ts">
import { useNextAndPrevLinks } from '../composables/nextAndPrevLinks'
import { withBase } from '../utils'
import { useNextAndPrevLinks } from '../composables/nextAndPrevLinks'
import ArrowLeft from './icons/ArrowLeft.vue'
import ArrowRight from './icons/ArrowRight.vue'

@ -16,6 +16,7 @@ export type BuildOptions = Pick<
export async function build(buildOptions: BuildOptions = {}) {
const start = Date.now()
process.env.NODE_ENV = 'production'
const siteConfig = await resolveConfig(buildOptions.root)
@ -67,5 +68,6 @@ export async function build(buildOptions: BuildOptions = {}) {
} finally {
await fs.remove(siteConfig.tempDir)
}
console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`)
}

@ -88,6 +88,7 @@ export async function bundle(
if (!isClientBuild) {
return
}
// for each .md entry chunk, adjust its name to its correct path.
for (const name in bundle) {
const chunk = bundle[name]

@ -71,9 +71,11 @@ function injectPageData(tags: string[], data: PageData) {
const code = `\nexport const __pageData = ${JSON.stringify(
JSON.stringify(data)
)}`
const existingScriptIndex = tags.findIndex(
(tag) => scriptRE.test(tag) && !scriptSetupRE.test(tag)
)
const existingScriptIndex = tags.findIndex((tag) => {
return scriptRE.test(tag) && !scriptSetupRE.test(tag)
})
if (existingScriptIndex > -1) {
const tagSrc = tags[existingScriptIndex]
// user has <script> tag inside markdown

Loading…
Cancel
Save