Closed rtsao closed 7 years ago
Did you ever consider using postcss
for scoping the CSS?
Yes, originally I looked at postcss but it's a pretty heavy dependency. I wanted csjs to be really lightweight so when I realized I could do the basics with simple regex and replacement, I went with that approach.
The lexer in this PR is very optimized for the concerns of csjs so it should be faster than other more general parsing solutions that need to account for the entirety of CSS.
Closing for now as this is isn't going to happen in the near term. This needs to be investigated further, though.
See: https://github.com/rtsao/csjs/issues/39
This is a pretty significant refactor. Scoping is now based on tokenization, which based on early benchmarks, should speed things up significantly. Lexer is based on the lexer from https://github.com/brettstimmerman/mensch but modified to be faster and avoid doing work we don't need for CSJS
Remaining items:
This would also be an opportunity to do something like: https://github.com/rtsao/csjs/issues/34 and https://github.com/rtsao/csjs/issues/25