|
| 1 | +%YAML 1.2 |
| 2 | +--- |
| 3 | +# http://www.sublimetext.com/docs/syntax.html |
| 4 | +name: PostCSS |
| 5 | +scope: source.postcss |
| 6 | + |
| 7 | +file_extensions: |
| 8 | + - pcss |
| 9 | + - postcss |
| 10 | + |
| 11 | +contexts: |
| 12 | + main: |
| 13 | + - match: /\* |
| 14 | + push: |
| 15 | + - meta_scope: comment.block.postcss |
| 16 | + - match: \*/ |
| 17 | + pop: true |
| 18 | + - include: comment-tag |
| 19 | + - include: double-slash |
| 20 | + - include: double-quoted |
| 21 | + - include: single-quoted |
| 22 | + - include: interpolation |
| 23 | + - include: placeholder-selector |
| 24 | + - include: variable |
| 25 | + - include: variable-root-css |
| 26 | + - include: numeric |
| 27 | + - include: unit |
| 28 | + - include: flag |
| 29 | + - include: dotdotdot |
| 30 | + - match: '@include' |
| 31 | + scope: keyword.control.at-rule.css.postcss |
| 32 | + push: |
| 33 | + - meta_scope: support.function.name.postcss.library |
| 34 | + - match: '(?=\n|\(|{|;)' |
| 35 | + scope: keyword.control.at-rule.css.postcss |
| 36 | + pop: true |
| 37 | + - match: '@mixin|@function' |
| 38 | + scope: keyword.control.at-rule.css.postcss |
| 39 | + push: |
| 40 | + - meta_scope: support.function.name.postcss.no-completions |
| 41 | + - match: '$\n?|(?=\(|{)' |
| 42 | + scope: keyword.control.at-rule.css.postcss |
| 43 | + pop: true |
| 44 | + - match: '[\w-]+' |
| 45 | + scope: entity.name.function |
| 46 | + - match: '(?<=@import)\s[\w/.*-]+' |
| 47 | + scope: string.quoted.double.css.postcss |
| 48 | + - match: '@' |
| 49 | + push: |
| 50 | + - meta_scope: keyword.control.at-rule.css.postcss |
| 51 | + - match: $\n?|\s(?!(all|braille|embossed|handheld|print|projection|screen|speech|tty|tv|if|only|not)(\s|,))|(?=;) |
| 52 | + pop: true |
| 53 | + - match: '#' |
| 54 | + push: |
| 55 | + - meta_scope: entity.other.attribute-name.id.css.postcss |
| 56 | + - match: '$\n?|(?=\s|,|;|\(|\)|\.|\[|{|>)' |
| 57 | + pop: true |
| 58 | + - include: interpolation |
| 59 | + - include: pseudo-class |
| 60 | + - match: \.|(?<=&)(-|_) |
| 61 | + push: |
| 62 | + - meta_scope: entity.other.attribute-name.class.css.postcss |
| 63 | + - match: '$\n?|(?=\s|,|;|\(|\)|\[|{|>)' |
| 64 | + pop: true |
| 65 | + - include: interpolation |
| 66 | + - include: pseudo-class |
| 67 | + - match: '\[' |
| 68 | + push: |
| 69 | + - meta_scope: entity.other.attribute-selector.postcss |
| 70 | + - match: '\]' |
| 71 | + pop: true |
| 72 | + - include: double-quoted |
| 73 | + - include: single-quoted |
| 74 | + - match: \^|\$|\*|~ |
| 75 | + scope: keyword.other.regex.postcss |
| 76 | + - match: '(?<=\]|\)|not\(|\*|>|>\s):[a-z:-]+|(::|:-)[a-z:-]+' |
| 77 | + scope: entity.other.attribute-name.pseudo-class.css.postcss |
| 78 | + - match: ':' |
| 79 | + push: |
| 80 | + - meta_scope: meta.property-list.css.postcss |
| 81 | + - match: '$\n?|(?=;|\s\(|and\(|{|}|\),)' |
| 82 | + pop: true |
| 83 | + - include: double-slash |
| 84 | + - include: double-quoted |
| 85 | + - include: single-quoted |
| 86 | + - include: interpolation |
| 87 | + - include: variable |
| 88 | + - include: rgb-value |
| 89 | + - include: numeric |
| 90 | + - include: unit |
| 91 | + - include: flag |
| 92 | + - include: function |
| 93 | + - include: function-content |
| 94 | + - include: function-content-var |
| 95 | + - include: operator |
| 96 | + - include: parent-selector |
| 97 | + - include: property-value |
| 98 | + - include: rgb-value |
| 99 | + - include: function |
| 100 | + - include: function-content |
| 101 | + - match: '(?<!\-|\()\b(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|embed|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|picture|pre|progress|q|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|main|svg|rect|ruby|center|circle|ellipse|line|polyline|polygon|path|text|u|x)\b(?!-|\)|:\s)|&' |
| 102 | + push: |
| 103 | + - meta_scope: entity.name.tag.css.postcss.symbol |
| 104 | + - match: '(?=\s|,|;|\(|\)|\.|\[|{|>|-|_)' |
| 105 | + pop: true |
| 106 | + - include: interpolation |
| 107 | + - include: pseudo-class |
| 108 | + - include: operator |
| 109 | + - match: '[a-z-]+((?=:|#{))' |
| 110 | + scope: support.type.property-name.css.postcss |
| 111 | + - include: reserved-words |
| 112 | + - include: property-value |
| 113 | + |
| 114 | + comment-tag: |
| 115 | + - match: '{{' |
| 116 | + push: |
| 117 | + - meta_scope: comment.tags.postcss |
| 118 | + - match: '}}' |
| 119 | + pop: true |
| 120 | + - match: '[\w-]+' |
| 121 | + scope: comment.tag.postcss |
| 122 | + |
| 123 | + dotdotdot: |
| 124 | + - match: '\.{3}' |
| 125 | + scope: variable.other |
| 126 | + |
| 127 | + double-quoted: |
| 128 | + - match: '"' |
| 129 | + push: |
| 130 | + - meta_scope: string.quoted.double.css.postcss |
| 131 | + - match: '"' |
| 132 | + pop: true |
| 133 | + - include: quoted-interpolation |
| 134 | + |
| 135 | + double-slash: |
| 136 | + - match: // |
| 137 | + push: |
| 138 | + - meta_scope: comment.line.postcss |
| 139 | + - match: $ |
| 140 | + pop: true |
| 141 | + - include: comment-tag |
| 142 | + |
| 143 | + flag: |
| 144 | + - match: '!(important|default|optional|global)' |
| 145 | + scope: keyword.other.important.css.postcss |
| 146 | + |
| 147 | + function: |
| 148 | + - match: '(?<=[\s|\(|,|:])(?!url|format|attr)[\w-][\w-]*(?=\()' |
| 149 | + scope: support.function.name.postcss |
| 150 | + |
| 151 | + function-content: |
| 152 | + - match: (?<=url\(|format\(|attr\().+?(?=\)) |
| 153 | + scope: string.quoted.double.css.postcss |
| 154 | + |
| 155 | + function-content-var: |
| 156 | + - match: '(?<=var\()[\w-]+(?=\))' |
| 157 | + scope: variable.parameter.postcss |
| 158 | + |
| 159 | + interpolation: |
| 160 | + - match: '#{' |
| 161 | + push: |
| 162 | + - meta_scope: support.function.interpolation.postcss |
| 163 | + - match: '}' |
| 164 | + pop: true |
| 165 | + - include: variable |
| 166 | + - include: numeric |
| 167 | + - include: operator |
| 168 | + - include: unit |
| 169 | + - include: double-quoted |
| 170 | + - include: single-quoted |
| 171 | + |
| 172 | + numeric: |
| 173 | + - match: '(-|\.)?[0-9]+(\.[0-9]+)?' |
| 174 | + scope: constant.numeric.css.postcss |
| 175 | + |
| 176 | + operator: |
| 177 | + - match: \+|\s-\s|\s-(?=\$)|(?<=\()-(?=\$)|\s-(?=\()|\*|/|%|=|!|<|>|~ |
| 178 | + scope: keyword.operator.postcss |
| 179 | + |
| 180 | + parent-selector: |
| 181 | + - match: '&' |
| 182 | + scope: entity.name.tag.css.postcss |
| 183 | + |
| 184 | + placeholder-selector: |
| 185 | + - match: (?<!\d)%(?!\d) |
| 186 | + push: |
| 187 | + - meta_scope: entity.other.attribute-name.placeholder-selector.postcss |
| 188 | + - match: '$\n?|\s|(?=;|{)' |
| 189 | + pop: true |
| 190 | + |
| 191 | + property-value: |
| 192 | + - match: '[\w-]+' |
| 193 | + scope: meta.property-value.css.postcss, support.constant.property-value.css.postcss |
| 194 | + |
| 195 | + pseudo-class: |
| 196 | + - match: ':[a-z:-]+' |
| 197 | + scope: entity.other.attribute-name.pseudo-class.css.postcss |
| 198 | + |
| 199 | + quoted-interpolation: |
| 200 | + - match: '#{' |
| 201 | + push: |
| 202 | + - meta_scope: support.function.interpolation.postcss |
| 203 | + - match: '}' |
| 204 | + pop: true |
| 205 | + - include: variable |
| 206 | + - include: numeric |
| 207 | + - include: operator |
| 208 | + - include: unit |
| 209 | + |
| 210 | + reserved-words: |
| 211 | + - match: \b(false|from|in|not|null|through|to|true)\b |
| 212 | + scope: support.type.property-name.css.postcss |
| 213 | + |
| 214 | + rgb-value: |
| 215 | + - match: '(#)([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b' |
| 216 | + scope: constant.other.color.rgb-value.css.postcss |
| 217 | + |
| 218 | + single-quoted: |
| 219 | + - match: "'" |
| 220 | + push: |
| 221 | + - meta_scope: string.quoted.single.css.postcss |
| 222 | + - match: "'" |
| 223 | + pop: true |
| 224 | + - include: quoted-interpolation |
| 225 | + |
| 226 | + unit: |
| 227 | + - match: '(?<=[\d]|})(ch|cm|deg|dpcm|dpi|dppx|em|ex|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vw|%)' |
| 228 | + scope: keyword.other.unit.css.postcss |
| 229 | + |
| 230 | + variable: |
| 231 | + - match: '\$[\w-]+' |
| 232 | + scope: variable.parameter.postcss |
| 233 | + |
| 234 | + variable-root-css: |
| 235 | + - match: '(?<!&)--[\w-]+' |
| 236 | + scope: variable.parameter.postcss |
0 commit comments