css.js
1.77 KB
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
/**
* CSS patterns
*
* @author Craig Campbell
* @version 1.0.9
*/
Rainbow.extend('css', [
{
'name': 'comment',
'pattern': /\/\*[\s\S]*?\*\//gm
},
{
'name': 'constant.hex-color',
'pattern': /#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s|,|\))/gi
},
{
'matches': {
1: 'constant.numeric',
2: 'keyword.unit'
},
'pattern': /(\d+)(px|em|cm|s|%)?/g
},
{
'name': 'string',
'pattern': /('|")(.*?)\1/g
},
{
'name': 'support.css-property',
'matches': {
1: 'support.vendor-prefix'
},
'pattern': /(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g
},
{
'matches': {
1: [
{
'name': 'entity.name.sass',
'pattern': /&/g
},
{
'name': 'direct-descendant',
'pattern': />/g
},
{
'name': 'entity.name.class',
'pattern': /\.[\w\-_]+/g
},
{
'name': 'entity.name.id',
'pattern': /\#[\w\-_]+/g
},
{
'name': 'entity.name.pseudo',
'pattern': /:[\w\-_]+/g
},
{
'name': 'entity.name.tag',
'pattern': /\w+/g
}
]
},
'pattern': /([\w\ ,\n:\.\#\&\;\-_]+)(?=.*\{)/g
},
{
'matches': {
2: 'support.vendor-prefix',
3: 'support.css-value'
},
'pattern': /(:|,)\s*(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g
}
], true);