1 | Prism.languages.scss = Prism.languages.extend('css', {
|
2 | 'comment': {
|
3 | pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
|
4 | lookbehind: true
|
5 | },
|
6 | 'atrule': {
|
7 | pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,
|
8 | inside: {
|
9 | 'rule': /@[\w-]+/
|
10 |
|
11 | }
|
12 | },
|
13 |
|
14 | 'url': /(?:[-a-z]+-)?url(?=\()/i,
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | 'selector': {
|
23 |
|
24 | pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,
|
25 | inside: {
|
26 | 'parent': {
|
27 | pattern: /&/,
|
28 | alias: 'important'
|
29 | },
|
30 | 'placeholder': /%[-\w]+/,
|
31 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
|
32 | }
|
33 | },
|
34 | 'property': {
|
35 | pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/,
|
36 | inside: {
|
37 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
|
38 | }
|
39 | }
|
40 | });
|
41 |
|
42 | Prism.languages.insertBefore('scss', 'atrule', {
|
43 | 'keyword': [
|
44 | /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,
|
45 | {
|
46 | pattern: /( +)(?:from|through)(?= )/,
|
47 | lookbehind: true
|
48 | }
|
49 | ]
|
50 | });
|
51 |
|
52 | Prism.languages.insertBefore('scss', 'important', {
|
53 |
|
54 | 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
|
55 | });
|
56 |
|
57 | Prism.languages.insertBefore('scss', 'function', {
|
58 | 'placeholder': {
|
59 | pattern: /%[-\w]+/,
|
60 | alias: 'selector'
|
61 | },
|
62 | 'statement': {
|
63 | pattern: /\B!(?:default|optional)\b/i,
|
64 | alias: 'keyword'
|
65 | },
|
66 | 'boolean': /\b(?:true|false)\b/,
|
67 | 'null': {
|
68 | pattern: /\bnull\b/,
|
69 | alias: 'keyword'
|
70 | },
|
71 | 'operator': {
|
72 | pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
|
73 | lookbehind: true
|
74 | }
|
75 | });
|
76 |
|
77 | Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
|