Skip to content

Add nuxt-script snippets #16

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

Merged
merged 2 commits into from
Aug 7, 2022
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
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
{
"language": "html",
"path": "./snippets/nuxt-template.code-snippets"
},
{
"language": "javascript",
"path": "./snippets/nuxt-script.code-snippets"
},
{
"language": "typescript",
"path": "./snippets/nuxt-script.code-snippets"
}
]
}
Expand Down
83 changes: 83 additions & 0 deletions snippets/nuxt-script.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"Nuxt useFetch": {
"prefix": "nfetch",
"body": [
"const { data: ${1:name} } = await useFetch('${2:path}')"
],
"description": "Nuxt useFetch composable"
},
"Nuxt useLazyFetch": {
"prefix": "nfetch-lazy",
"body": [
"const { pending, data: ${1:name} } = await useLazyFetch('${2:path}')"
],
"description": "Nuxt useLazyFetch composable"
},
"Nuxt useAsyncData": {
"prefix": "nasyncdata",
"body": [
"const { data: ${1:name} } = await useAsyncData('${2:requestKey}', () => \\$fetch('${3:path}'))"
],
"description": "Nuxt useAsyncData composable"
},
"Nuxt useLazyAsyncData": {
"prefix": "nasyncdata-lazy",
"body": [
"const { pending, data: ${1:name} } = await useLazyAsyncData('${2:requestKey}', () => \\$fetch('${3:path}'))"
],
"description": "Nuxt useLazyAsyncData composable"
},
"Nuxt useHead": {
"prefix": "nhead",
"body": [
"useHead({",
"\ttitle: ${1:pageTitle},",
"})"
],
"description": "Nuxt useHead composable"
},
"Nuxt useHead with description": {
"prefix": "nhead-description",
"body": [
"useHead({",
"\ttitle: ${1:pageTitle},",
"\tmeta: [",
"\t\t{ name: 'description', content: ${2:pageDescription} },",
"\t],",
"})"
],
"description": "Nuxt useHead composable with description"
},
"Nuxt useHead - Title template": {
"prefix": "nhead-template",
"body": [
"useHead({",
"\ttitleTemplate: (titleChunk) => {",
"\t\treturn titleChunk ? `\\${titleChunk} - ${1:siteTitle}` : '${1:siteTitle}'",
"\t}",
"})"
],
"description": "Nuxt useHead composable with title template"
},
"Nuxt definePageMeta": {
"prefix": "npagemeta",
"body": [
"definePageMeta({",
"\ttitle: '${1:pageTitle}',",
"})"
],
"description": "Nuxt definePageMeta composable"
},
"Nuxt definePageMeta with description": {
"prefix": "npagemeta-description",
"body": [
"definePageMeta({",
"\ttitle: '${1:pageTitle}',",
"\tmeta: [",
"\t\t{ name: 'description', content: '${2:pageDescription}' },",
"\t],",
"})"
],
"description": "Nuxt definePageMeta composable with description"
},
}