Skip to content

Commit

Permalink
Base syntax on CSS of ST4174
Browse files Browse the repository at this point in the history
ST4174 introduced support for relaxed CSS nesting which basically means,
full PostCSS like nesting of selectors and rules.

This reduces Tailwind CSS to just adding some additional at-rules.

All other structure modifying context overrides are removed to ensure
compatibility with core CSS.
  • Loading branch information
deathaxe committed Oct 26, 2024
1 parent a4ca62e commit a223508
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 99 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/ci-syntax-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ jobs:
strategy:
matrix:
include:
- build: 4107
default_packages: v4107
- build: 4126
default_packages: v4126
- build: 4143
default_packages: v4143
- build: 4152
default_packages: v4152
- build: 4169
default_packages: v4169
- build: 4173
default_packages: v4173
- build: 4174 # first supported build
default_packages: v4174
- build: 4180 # first stable build
default_packages: v4180
- build: latest
default_packages: master
steps:
- name: Checkout Default Packages
uses: actions/checkout@v4
Expand Down
87 changes: 0 additions & 87 deletions Tailwind CSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,8 @@ extends: Packages/CSS/CSS.sublime-syntax
file_extensions:
- tailwind.css

variables:

# Block punctuations
# Provides an easy and safe interface for template syntaxes to override
# block punctuation patterns to prevent ambiguities with interpolations.
# It helps to correctly highlight {{ tag }} { {{prop}}: {{value}} }
block_start: \{
block_end: \}

# Properties and Selectors
property_or_selector_begin: (?={{ident_begin}}|{{selector_start}})
property_end: (?=[;@)}])

selector_start: '[[:alpha:].:#&*\[{{combinator_char}}]'
selector_end: (?=[;@(){}])

contexts:

stylesheet:
# relaxed properties vs. selectors
- meta_include_prototype: false
- include: comments
- include: properties-or-selectors
- include: at-rules
- include: property-lists
- include: rule-terminators
- include: illegal-commas
- include: illegal-groups

###[ CSS AT RULES ]############################################################

at-other:
Expand All @@ -49,66 +22,6 @@ contexts:
- include: tailwind-at-variants
- include: tailwind-at-screen

###[ CSS SELECTORS ]###########################################################

properties-or-selectors:
# required until ST4174 (PR #3898)
- match: '{{property_or_selector_begin}}'
branch_point: property-or-selector
branch:
- maybe-property
- selector-body

maybe-property:
# required until ST4174 (PR #3898)
- meta_include_prototype: false
- include: property-end
- include: property-identifiers
- match: ''
fail: property-or-selector

property-end:
# required until ST4174 (PR #3898)
- match: '{{property_end}}'
pop: 1

selector-variables:
# required until ST4174 (PR #3898)
- meta_prepend: true
- match: \&
scope: variable.language.parent.css

###[ CSS STYLESHEET BLOCKS ]####################################################

maybe-stylesheet-block:
# required until ST4174 (PR #3831)
- meta_include_prototype: false
- match: '{{block_start}}'
scope: punctuation.section.block.begin.css
set: stylesheet-block-body
- include: comments
- include: else-pop

stylesheet-block-body:
# required until ST4174 (PR #3831)
- meta_include_prototype: false
- meta_scope: meta.block.css
- include: block-end
- include: stylesheet

###[ CSS PROPERTY LISTS ]######################################################

property-list-body:
# relaxed properties vs. selectors
- meta_scope: meta.property-list.css meta.block.css
- include: block-end
- include: stylesheet

illegal-commas:
# required until ST4174 (PR #3831)
- match: ','
scope: invalid.illegal.unexpected-token.css

###[ TAILWIND INLINE AT RULES ]################################################

tailwind-at-apply:
Expand Down

0 comments on commit a223508

Please sign in to comment.