Skip to content

Commit

Permalink
[CSS] Add support for syntax dialects
Browse files Browse the repository at this point in the history
This commit
1. renames CSS.sublime-syntax to CSS (Plain).sublime-syntax
2. creates an inherit CSS from CSS (Plain)

Goal
----

Support different CSS dialects (Basic, PostCSS, Tailwind CSS, ...) in
embedded code scenarios including templating support.

Motivation
----------

More and more syntax packages inherit CSS.sublime-syntax to add support
for interpolation or embed template tags (e.g.: ASP, JSP, PHP, Liquid,
Vue, ...).

Other packages might provide certain dialects of CSS, such as PostCSS
or Tailwind CSS.

It is currently not easily possible to embed Tailwind CSS in PHP or
Liquid without rewriting each of those syntaxes, because all of them
rely on default CSS.sublime-syntax due to inheritance depending on
file names rather than scopes.

The motivation is to enable exactly this (again), to benefit from both
inheritance and flexibility from 3rd-party packages.

Strategy
--------

The idea is to turn CSS.sublime-syntax into an interface, which is
inherit from CSS (Plain) and can be extended by and embedded into
syntax definitions such as PHP, while being able to easily create an
override with `extends` value replaced by desired syntax dialect
(e.g.: Tailwind CSS).

       CSS (PHP)
          |
         CSS
          |  \
          |  Tailwind CSS
          |   |
          |  PostCSS
          |  /
         CSS (Plain)

Note: It follows the idea being discussed in SQL (sublimehq#3046).
  • Loading branch information
deathaxe committed Mar 15, 2024
1 parent 2805af6 commit 29921ff
Show file tree
Hide file tree
Showing 2 changed files with 3,516 additions and 3,507 deletions.
Loading

0 comments on commit 29921ff

Please sign in to comment.