Skip to content

New version

Pre-release
Pre-release
Compare
Choose a tag to compare
@gaku-sei gaku-sei released this 24 Jul 10:41
· 1 commit to master since this release
6b9fdd9

Getting close to the release. The cli is now feature complete and the code moslty optimized (could still improve the binary size though).

There are many breaking changes with the previous version (mostly due to the renaming tailwind-generator -> style-generator), for both the cli itself and the generated code. Here is a simple, non exhaustive list:

Removed

  • ReasonML is not supported anymore, but 2 new generators for ReScript are now available!

Changed

  • Exit PureScript, welcome Rust. As much as I love PureScript, Rust is pretty hard to beat when it comes to speed: the current version takes up to 4 seconds to generate an Elm file vs 0.8 second for Rust (and 0.1 second when using the binary itself, without yarn or npm, that is, yes, 40x faster).
  • The CLI doesn't read a provided tailwind config file anymore, and doesn't call tailwind for you, this allows for a more generic tool that can support any css file. In short instead of tailwind-generator [...] you need to call tailwind [...] && style-generator [...].
  • As a consequence the -c option has been dropped
  • The input/output options --cssOutput|--cssInput|--output have been revamped, -i|--input is the source, a path to a css file or an URL, -o|--output-directory is the output directory, and -f|--output-filename is the filename (without extension). The new api should be less error prone and more flexible.
  • Generated code: some functions have been renamed, but their behavior is the same.

Fixed

  • The new version supports more class names, and is less error prone. During some of my tests, I noticed that the tailwind css file we used as a reference had ~5500 classes but only ~5000 were found by the old parser! This is now hopefully fixed thanks to this awesome css parser library.
  • More control over the parser that's now 100% home made, additionally to the fix mentioned above, it also means we'll be able to easily fix bugs in the future we simply couldn't fix before.

Added

  • ReScript and ReScript type level, 2 new generators
  • The css! macro (accessible through the style-generator-macro crate), that allows for some very safe code in Rust. For instance the following code (using the Yew framework):
html! {
  <div class={css!("rounded px-2 py-1")}>{ "Hello" }</div>
}

Would verify at compile time that the classes rounded, px-2, and py-1 exist in the provided css file.