swc-project / swc

Rust-based platform for the Web
https://swc.rs
Apache License 2.0
31.27k stars 1.23k forks source link

Documentation for CSS Features #3900

Open onigoetz opened 2 years ago

onigoetz commented 2 years ago

Describe the feature

I saw that the changelog has many mentions for CSS features (parser, linter, minifier )

I would be very interested to see the documentation but couldn't find it, is there anything published yet ?

And some side questions

Babel plugin or link to the feature description

No response

Additional context

No response

kdy1 commented 2 years ago

It's not published yet

alexander-akait commented 2 years ago

@onigoetz

There is the @parcel/css package that seems to provide similar CSS features, is there some collaboration between the two projects ?

Parcel is just CSS bundler and minifier, we use another approach - AST (parser/codegen/etc) + transformations + plugins support (in future), so it's a slightly different approaches.

But yes we should improve docs here, it is young and there are a lot of rooms to improve

onigoetz commented 2 years ago

It's not only a bundler and minifier. They also provide vendor prefixing and fallbacks (nesting, css colors level 4 fallback and more) I'm also pretty sure they want to add plugin support.

@devongovett built it. He certainly knows better what will and will not come in @parcel/css future

alexander-akait commented 2 years ago

@devongovett Not fully truth, we use the both approaches, trying to parser known and provide more better AST structures where we known how to parser, if we can't parser we provide generic AST (at the moment we are not processing too many things, but it designed to do it and we are continuing improve it).

We want to help not only bundling, our area is more - linter/formatter/etc so we need AST here and some more generic structures (especial for recovery mode), so author can write plugins for future CSS syntax without problems.

Parcel CSS works more like browsers and fully parses all known properties, whereas SWC provides a more generic AST that each consumer must interpret themselves.

This statement is not entirely correct. We also parser like a browser, just what the browser cannot parse, we put it in common AST structures, as I said earlier.

I suggested working together on it in the past (https://github.com/swc-project/swc/pull/2884), but the SWC developers wanted to go in a different direction.

No one refused to help, you want to develop it in another repository, like a side project, unfortunately, this approach in organizational terms does not suit us