matheus23 / elm-tailwind-modules

Generate Elm code for Tailwind Utilities and Components that purges using Elm's dead code elimination!
https://matheus23.github.io/elm-tailwind-modules/
117 stars 12 forks source link

Replace percentage sign in generated functions #27

Closed nidico closed 1 year ago

nidico commented 1 year ago

As described #25, Tailwindcss 3.3.0 introduced new utility classes with percent signs in tailwindlabs/tailwindcss#10886 - which is invalid in Elm function names.

This PR makes sure the % sign is replaced with pct in the generated Elm files.

Fixes #25.

Note that the test suite fails when setting devDependencies.tailwindcss to 3.3.1 because of

I'm unsure how to proceed as the test suite is the same no matter which tailwindcss version is used, so it might be okay to just test 3.1.6? However in that version, the % issue doesn't exist...

matheus23 commented 1 year ago

Thank you very much for the contribution!

Note that the test suite fails when setting devDependencies.tailwindcss to 3.3.1 because of

  • a type error (ResolvedConfig seems to have a signature change as of 3.2.x)

Yeah. I'm not sure exactly how we should resolve this. I guess let's just update to the new type and update to the new tailwindcss version, too (as in, the yarn.lock should refer to the new tailwindcss version so the tests run with the new version).

  • snapshot test errors.

You can re-generate the snapshots by running yarn test -u (the -u flag updates snapshots). The snapshots are mostly there to make sure that refactorings don't actually change behavior. This wouldn't be a refactor, so it's fine :)

nidico commented 1 year ago

Note that the test suite fails when setting devDependencies.tailwindcss to 3.3.1 because of

  • a type error (ResolvedConfig seems to have a signature change as of 3.2.x)

Yeah. I'm not sure exactly how we should resolve this. I guess let's just update to the new type and update to the new tailwindcss version, too (as in, the yarn.lock should refer to the new tailwindcss version so the tests run with the new version).

I tried to do my best with both - updated type signature and yarn upgrade. Feel free to append any changes... At least it works and the test suite is happy... ;)

  • snapshot test errors.

You can re-generate the snapshots by running yarn test -u (the -u flag updates snapshots). The snapshots are mostly there to make sure that refactorings don't actually change behavior. This wouldn't be a refactor, so it's fine :)

Understand, done.

matheus23 commented 1 year ago

This is great, thank you! I added you as collaborator to this repository, so if you want to create a PR in the future, feel free to just create a branch in this repo instead of forking (I find that usually makes it easier for me). :v: