Live data from Hacker News

Parcel CSS: A new CSS parser, compiler, and minifier

parceljs.org

51–60 of 129 posts

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#51
Unrelated but regarding SCSS/SASS: I am curious, why did we invent a new syntax for scss instead of writing a library in Python or Go that maps data-objects to CSS classes? You have full access to a proper programming language instead of this new DSL we need to learn. I tried searching for it but no luck, any reason why we don't do this?

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#52
post #15

Earlier quoted context omitted.

Because the hex for green (#00ff00) needs more letters than using the named color.

That's an... interesting optimization, and one that might make sense if you only care about byte size, but intuition (which might be wrong!) tells me that this will be more expensive (especially if it saves only one or two bytes). I'd bet that browsers can more quickly parse a string like '0x00ff00' into its internal color representation than it can parse the string 'green'. It's probably faster to check for a '0x' p…

> one that might make sense if you only care about byte size

A minimizer should care a lot abut size. I'm not sure what would be faster, but the difference must be minimal anyway, so it's safe to focus on your default concern.

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#54

Why is a product written in Rust have “JS” (javascript) in its URL name? I nearly didn't look at this because I didn't want another javascript dependance in my pipeline.

It seems Parcel CSS is a project from the creators of Parcel JS, which is a build tool. The URL isn't linking to the top-level page on the domain

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#55

Unrelated but regarding SCSS/SASS: I am curious, why did we invent a new syntax for scss instead of writing a library in Python or Go that maps data-objects to CSS classes? You have full access to a proper programming language instead of this new DSL we need to learn. I tried searching for it but no luck, any reason why we don't do this?

It's called interoperable css [0] or css modules [1].

[0] https://github.com/css-modules/icss

[1] https://github.com/css-modules/css-modules

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#57
post #2

What does it mean to compile CSS? Pack multiple files into one? Resolve and inline variables? Convert nested rules into flat CSS? Something else? I'm really not sure.

Elitism about the term "compiler" aside, I've been reading through The History of the FORTRAN Programming Language and funnily enough compile in those historic CS contexts just meant what "to compile" means in English: merging things together. It's an interesting read whatever the case.

[0] https://www.goodreads.com/book/show/52320048-abstracting-awa...

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#58
The syntax lowering and modules handling might be really nice. Maybe even the tree-shaking. Minification, thought, especially with this level of parsing, just seems like an elaborate waste of effort if the web server is set to gzip the final CSS file, anyway.

Re: Parcel CSS: A new CSS parser, compiler, and minifier

#59

This is amazing! Seen a lot of work around Rust and JS / JSX / TS / TSX (notably SWC[0] is moving to be a Rust based version of Babel) not so much around CSS. My genunine hope is this will replace PostCSS sooner rather than later. PostCSS isn't the most performant thing I've worked with, and a lot of plugins for PostCSS rely on doing multiple passes at the AST, they can slow down significantly as a result For that ho…

Hi, author of Parcel CSS here. I have been thinking about implementing the CSS OM spec as the JS API. This is the same API that browsers expose for manipulating stylesheets. The advantage of this is that we don't need to invent something custom. Still thinking through options. https://github.com/parcel-bundler/parcel-css/issues/5 That said, I think I'd want to keep the use cases for JS plugins limited, because it wil…

Is this something that can run in browser Workers via wasm or other means?

Most of CSS OM is already implemented in Javascript which can come in handy for this project:

https://github.com/NV/CSSOM

https://github.com/jsdom/cssstyle

(both of which jsdom use internally. cssstyle is a kind of updated version for some parts of CSSOM)

Post reply on HN