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
############# HTML #############
注意:在HTML文檔中阳堕,不能使用.source.html 而是使用 .text.html !!!!! 查了2個小時才找到問題
'.text.html':
'viewport':
'prefix': 'viewport'
'body': '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">'
'description': "for mobile"
'HTML':
'prefix': 'html2'
'body': '''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<style media="screen">
$2
</style>
</head>
<body>
$1
</body>
<script type="text/javascript">
$3
</script>
</html>
'''
'description': 'html init with script and css'
############# CSS #############
暫時還不可以使用啸澡,原因未查明抬伺。趴腋。。。
'.source.css':
'Multiline comment':
'prefix': '///'
'body': '''
/*
$1
*/
'''
############# JS #############
'.source.js':
'document.write()':
'prefix': 'write'
'body': 'document.write("$1");'
'get element by id':
'prefix': 'gi'
'body': 'document.getElementById("$1");'
'description': 'get element by id'
'query selector':
'prefix': 'qs'
'body': 'document.querySelector("$1");'
'description': 'query element by selector'
'query selector all':
'prefix': 'qsa'
'body': 'document.querySelectorAll("$1");'
'description': 'get elements by querySelectorAll'