-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippets.cson
149 lines (141 loc) · 3.14 KB
/
snippets.cson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# https://atom.io/docs/latest/using-atom-basic-customization#cson
'.text.html.vue .source.js.embedded.html':
'Vue data':
prefix: 'data'
body: """
data() {
return {
$1
}
},
"""
'Vue props':
prefix: 'props'
body: """
props: {
${1:propName}: {
type: ${2:String},
default: ${0}
},
},
"""
'Vue methods':
prefix: 'methods'
body: """
methods: {
${1:name}() {
${0}
},
},
"""
'Vue computed':
prefix: 'computed'
body: """
computed: {
${1:name}() {
return ${0}
},
},
"""
'Vue watchers':
prefix: 'watch'
body: """
watch: {
${1:name}(value) {
${0}
},
},
"""
'Vue import component':
prefix: 'import'
body: 'import ${1:New} from \'@/components/${1:New}.vue\''
'.text.html.vue':
'Vue component skeleton':
prefix: 'vue'
body: """
<template>
$2
</template>
<script>
export default {
name: '$1',
}
</script>
"""
'Vue style tag':
prefix: 'vstyle'
body: """
<style lang="scss" scoped>
$1
</style>
"""
".source.js.jsx":
"ES6 Arrow function":
prefix: "6fn"
body: "const $1 = ($2) => $3"
"Import React":
prefix: "imr"
body: "import React from 'react';"
"Import ReactDOM":
prefix: "imrd"
body: "import ReactDOM from 'react-dom';"
"React: class skeleton (ES6)":
prefix: "rcla"
body: "class $1 extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t$2\n\t\t)\n\t}\n}"
"React: fetch call (ES6)":
prefix: "rfetch"
body: "fetch($1)\n\t.then(response => response.json())\n\t.then(data => {})"
"React: Link component tag":
prefix: "link"
body: "<Link to=\"$1\">$2</Link>"
"React: Route component tag":
prefix: "route"
body: "<Route path=\"$1\" component={$2}>$3</Route>"
"React: Router component tag":
prefix: "router"
body: "<Router history={ $1 }>$2</Router>"
"Webpack config starter":
prefix: "wpc"
body: """
module.exports = {
entry: '$1',
output: {
path: '$2',
filename: '$3',
},
devServer: {
inline: true,
contentBase: '$4',
port: 3333
},
module: {
loaders: [
{
test: ${5:/\\\\.js\$/},
exclude: ${6:/node_modules/},
loader: '${7:babel}'
}
]
}
}
"""