Skip to content

Commit 3f3ce9a

Browse files
authored
Merge branch 'master' into patch-1
2 parents c6e9247 + 19d8dcb commit 3f3ce9a

File tree

9 files changed

+278
-147
lines changed

9 files changed

+278
-147
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ jspm_packages
7474
# VS Code
7575
vsc-extension-quickstart.md
7676
*.vsix
77+
.vscode

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to the "vue-vscode-snippets" extension will be documented in
44

55
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
66

7+
## 1.9.0
8+
9+
- New vbase support: LESS, SASS, Stylus, no CSS
10+
- Fix pug support
11+
- Fix brackets on vue router
12+
- New snippets: Nuxt page snippets
13+
714
## 1.8.0
815

916
- New snippet: Vue router

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set
3232

3333
### Vue
3434

35-
| Snippet | Purpose |
36-
| ----------- | ------------------------------------------ |
37-
| `vbase` | Single file component base with SCSS |
38-
| `vbase-css` | Single file component base with CSS |
39-
| `vbase-pcss`| Single file component base with PostCSS |
40-
| `vbase-ts` | Single file component base with Typescript |
35+
| Snippet | Purpose |
36+
| ------------ | ------------------------------------------ |
37+
| `vbase` | Single file component base with SCSS |
38+
| `vbase-css` | Single file component base with CSS |
39+
| `vbase-pcss` | Single file component base with PostCSS |
40+
| `vbase-styl` | Single file component base with Stylus |
41+
| `vbase-ts` | Single file component base with Typescript |
42+
| `vbase-ns` | Single file component with no styles |
43+
| `vbase-sass` | Single file component base with SASS |
44+
| `vbase-less` | Single file component base with LESS |
4145

4246
### Template
4347

@@ -131,6 +135,14 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set
131135
| `nfont` | link to include fonts in a nuxt project, in nuxt-config |
132136
| `ncss` | link to css assets such as normalize |
133137

138+
### Nuxt Page
139+
140+
| Snippet | Purpose |
141+
| ------------ | -------------- |
142+
| `nasyncdata` | Nuxt asyncData |
143+
| `nfetch` | Nuxt Fetch |
144+
| `nhead` | Nuxt Head |
145+
134146
### Extra (plaintext)
135147

136148
| Snippet | Purpose |

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Vue VSCode Snippets",
44
"description": "Snippets that will supercharge your Vue workflow",
55
"icon": "images/vue-logo.png",
6-
"version": "1.8.0",
6+
"version": "1.9.0",
77
"publisher": "sdras",
88
"engines": {
99
"vscode": "^1.14.0"
@@ -33,6 +33,10 @@
3333
"language": "vue",
3434
"path": "./snippets/vue.json"
3535
},
36+
{
37+
"language": "jade",
38+
"path": "./snippets/vue-pug.json"
39+
},
3640
{
3741
"language": "html",
3842
"path": "./snippets/vue-template.json"
@@ -57,6 +61,10 @@
5761
"language": "javascript",
5862
"path": "./snippets/nuxt-config.json"
5963
},
64+
{
65+
"language": "javascript",
66+
"path": "./snippets/nuxt-script.json"
67+
},
6068
{
6169
"language": "typescript",
6270
"path": "./snippets/vue-script.json"

snippets/nuxt-script.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"Nuxt Async": {
3+
"prefix": "nasyncdata",
4+
"body": [
5+
"async asyncData ({ ${1:params} }) {",
6+
"\tconst { data } = await fetch(`${2:endpoint}`).then(res => res.json())",
7+
"\treturn { ${3:key}:${4:value} }",
8+
"},"
9+
],
10+
"description": "Nuxt asyncData"
11+
},
12+
"Nuxt Fetch": {
13+
"prefix": "nfetch",
14+
"body": [
15+
"async fetch ({ store, ${1:params} }) {",
16+
"\tlet { data } = await fetch('${2:endpoint}').then(res => res.json())",
17+
"\tstore.commit('${3:MUTATION_TYPE}', data)",
18+
"},"
19+
],
20+
"description": "Nuxt Fetch"
21+
},
22+
"Nuxt Head": {
23+
"prefix": "nhead",
24+
"body": [
25+
"head () {",
26+
"\treturn {",
27+
"\t\ttitle: ${1:'Page Title'},",
28+
"\t\tmeta: [",
29+
"\t\t\t// hid is used as unique identifier. Do not use `vmid` for it as it will not work",
30+
"\t\t\t{ hid: 'description', name: 'description', content: ${2:'My custom description'} }",
31+
"\t\t]",
32+
"\t}",
33+
"},"
34+
],
35+
"description": "Nuxt Head"
36+
}
37+
}

snippets/vue-script-router.json

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"\tmode: 'history',",
1313
"\troutes: [",
1414
"\t\t{ path: '/path', component: component }",
15-
"\t}",
15+
"\t]",
1616
"});"
1717
],
1818
"description": "Base for Vue Router"
@@ -35,7 +35,7 @@
3535
"body": [
3636
"router.beforeEach((to, from, next) => {",
3737
"\t${1:next();}",
38-
"};"
38+
"});"
3939
],
4040
"description": "Vue Router global guards beforeEach"
4141
},
@@ -44,26 +44,18 @@
4444
"body": [
4545
"router.beforeResolve((to, from, next) => {",
4646
"\t${1:next();}",
47-
"};"
47+
"});"
4848
],
4949
"description": "Vue Router global guards beforeResolve"
5050
},
5151
"Vue Router afterEach": {
5252
"prefix": "vaftereach",
53-
"body": [
54-
"router.afterEach((to, from) => {",
55-
"\t",
56-
"};"
57-
],
53+
"body": ["router.afterEach((to, from) => {", "\t", "});"],
5854
"description": "Vue Router global guards afterEach"
5955
},
6056
"Vue Router beforeEnter": {
6157
"prefix": "vbeforeenter",
62-
"body": [
63-
"beforeEnter(to, from, next) {",
64-
"\t${1:next();}",
65-
"},"
66-
],
58+
"body": ["beforeEnter(to, from, next) {", "\t${1:next();}", "},"],
6759
"description": "Vue Router per-route guard beforeEnter"
6860
},
6961
"Vue Router beforeRouteEnter": {
@@ -77,20 +69,12 @@
7769
},
7870
"Vue Router beforeRouteUpdate": {
7971
"prefix": "vbeforerouteupdate",
80-
"body": [
81-
"beforeRouteUpdate(to, from, next) {",
82-
"\t${1:next();}",
83-
"},"
84-
],
72+
"body": ["beforeRouteUpdate(to, from, next) {", "\t${1:next();}", "},"],
8573
"description": "Vue Router component guards beforeRouteUpdate"
8674
},
8775
"Vue Router beforeRouteLeave": {
8876
"prefix": "vbeforerouteleave",
89-
"body": [
90-
"beforeRouteLeave(to, from, next) {",
91-
"\t${1:next();}",
92-
"},"
93-
],
77+
"body": ["beforeRouteLeave(to, from, next) {", "\t${1:next();}", "},"],
9478
"description": "Vue Router component guards beforeRouteLeave"
9579
},
9680
"Vue Router Route": {

snippets/vue-script.json

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,73 +111,73 @@
111111
"Vue Import Export": {
112112
"prefix": "vimport-export",
113113
"body": [
114-
"import ${1:Name} from '@/components/${1:Name}.vue'",
114+
"import ${1:Name} from '@/components/${1:Name}.vue';",
115115
"",
116116
"export default {",
117117
"\tcomponents: {",
118118
"\t\t${1:Name}",
119119
"\t},",
120-
"}"
120+
"};"
121121
],
122122
"description": "import a component and include it in export default"
123123
},
124124
"Vue MapState": {
125125
"prefix": "vmapstate",
126126
"body": [
127-
"import { mapState } from 'vuex'",
127+
"import { mapState } from 'vuex';",
128128
"",
129129
"export default {",
130130
"\tcomputed: {",
131131
"\t\t...mapState([",
132132
"\t\t\t${1:'nameOfState'},",
133133
"\t\t])",
134134
"\t},",
135-
"}"
135+
"};"
136136
],
137137
"description": "map getters inside a vue component"
138138
},
139139
"Vue MapGetters": {
140140
"prefix": "vmapgetters",
141141
"body": [
142-
"import { mapGetters } from 'vuex'",
142+
"import { mapGetters } from 'vuex';",
143143
"",
144144
"export default {",
145145
"\tcomputed: {",
146146
"\t\t...mapGetters([",
147147
"\t\t\t${1:'nameOfGetter'},",
148148
"\t\t])",
149149
"\t},",
150-
"}"
150+
"};"
151151
],
152152
"description": "mapgetters inside a vue component"
153153
},
154154
"Vue MapMutations": {
155155
"prefix": "vmapmutations",
156156
"body": [
157-
"import { mapMutations } from 'vuex'",
157+
"import { mapMutations } from 'vuex';",
158158
"",
159159
"export default {",
160160
"\tmethods: {",
161161
"\t\t...mapMutations([",
162162
"\t\t\t${1:'nameOfMutation'}, //also supports payload `this.nameOfMutation(amount)` ",
163163
"\t\t])",
164164
"\t},",
165-
"}"
165+
"};"
166166
],
167167
"description": "mapmutations inside a vue component"
168168
},
169169
"Vue MapActions": {
170170
"prefix": "vmapactions",
171171
"body": [
172-
"import { mapActions } from 'vuex'",
172+
"import { mapActions } from 'vuex';",
173173
"",
174174
"export default {",
175175
"\tmethods: {",
176176
"\t\t...mapActions([",
177177
"\t\t\t${1:'nameOfAction'}, //also supports payload `this.nameOfAction(amount)` ",
178178
"\t\t])",
179179
"\t},",
180-
"}"
180+
"};"
181181
],
182182
"description": "mapactions inside a vue component"
183183
},
@@ -197,9 +197,9 @@
197197
"body": [
198198
"const ${1:mixinName} = {",
199199
"\tmounted() {",
200-
"\t\tconsole.log('hello from mixin!')",
200+
"\t\tconsole.log('hello from mixin!');",
201201
"\t},",
202-
"}"
202+
"};"
203203
],
204204
"description": "vue mixin"
205205
},
@@ -221,14 +221,13 @@
221221
},
222222
"Vue Import Library": {
223223
"prefix": "vimport-lib",
224-
"body": ["import { ${1:libName} } from '${1:libName}'"],
224+
"body": ["import { ${1:libName} } from '${1:libName}';"],
225225
"description": "import a library"
226226
},
227227
"Vue Import GSAP": {
228228
"prefix": "vimport-gsap",
229-
"body": ["import { TimelineMax, ${1:Ease} } from 'gsap'"],
230-
"description":
231-
"component methods options that dispatch an action from vuex store."
229+
"body": ["import { TimelineMax, ${1:Ease} } from 'gsap';"],
230+
"description": "component methods options that dispatch an action from vuex store."
232231
},
233232
"Vue Transition Methods with JavaScript Hooks": {
234233
"prefix": "vanimhook-js",
@@ -254,7 +253,7 @@
254253
"prefix": "vcommit",
255254
"body": [
256255
"${1:mutationName}() {",
257-
"\tthis.\\$store.commit('${1:mutationName}', ${2:payload})",
256+
"\tthis.\\$store.commit('${1:mutationName}', ${2:payload});",
258257
"}"
259258
],
260259
"description": "commit to vuex store in methods for mutation"
@@ -263,35 +262,35 @@
263262
"prefix": "vdispatch",
264263
"body": [
265264
"${1:actionName}() {",
266-
"\tthis.\\$store.dispatch('${1:actionName}', ${2:payload})",
265+
"\tthis.\\$store.dispatch('${1:actionName}', ${2:payload});",
267266
"}"
268267
],
269268
"description": "dispatch to vuex store in methods for action"
270269
},
271270
"Incrementer": {
272271
"prefix": "vinc",
273-
"body": ["return ${1:this.num} += ${2:1}"],
272+
"body": ["return ${1:this.num} += ${2:1};"],
274273
"description": "increment"
275274
},
276275
"Decrementer": {
277276
"prefix": "vdec",
278-
"body": ["return ${1:this.num} -= ${2:1}"],
277+
"body": ["return ${1:this.num} -= ${2:1};"],
279278
"description": "decrement"
280279
},
281280
"Unit Test": {
282281
"prefix": "vtest",
283282
"body": [
284-
"import Vue from 'vue'",
285-
"import ${1:HelloWorld} from './components/${1:HelloWorld}'",
283+
"import Vue from 'vue';",
284+
"import ${1:HelloWorld} from './components/${1:HelloWorld}';",
286285
"",
287286
"describe('${1:HelloWorld}.vue', () => {",
288287
"\tit('${2:should render correct contents}', () => {",
289-
"\t\tconst Constructor = Vue.extend(${1:HelloWorld})",
290-
"\t\tconst vm = new Constructor().$mount()",
288+
"\t\tconst Constructor = Vue.extend(${1:HelloWorld});",
289+
"\t\tconst vm = new Constructor().$mount();",
291290
"\t\texpect(vm.$el.querySelector('.hello h1').textContent)",
292-
"\t\t\t.to.equal(${3:'Welcome to Your Vue.js App'})",
293-
"\t})",
294-
"})"
291+
"\t\t\t.to.equal(${3:'Welcome to Your Vue.js App'});",
292+
"\t});",
293+
"});"
295294
],
296295
"description": "unit test component"
297296
},

snippets/vue-template.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,16 @@
9191
},
9292
"Vue Named Routing Link": {
9393
"prefix": "vroutename",
94-
"body": ["<router-link :to=\"{name: '${1:name}'}\">${2:LinkTitle}</router-link>"],
94+
"body": [
95+
"<router-link :to=\"{name: '${1:name}'}\">${2:LinkTitle}</router-link>"
96+
],
9597
"description": "Named routing link"
96-
},
98+
},
9799
"Vue Named Routing Link with Params": {
98100
"prefix": "vroutenameparam",
99-
"body": ["<router-link :to=\"{name: '${1:name}', params:{${2:id}: '${3:value}'} }\">${4:LinkTitle}</router-link>"],
101+
"body": [
102+
"<router-link :to=\"{name: '${1:name}', params:{${2:id}: '${3:value}'} }\">${4:LinkTitle}</router-link>"
103+
],
100104
"description": "Named routing link w/ params"
101105
},
102106
"Vue Path Routing Link": {

0 commit comments

Comments
 (0)