arlyon / stailwc

Tailwind in SWC, Nextjs, and Vite, fast 🚀
https://npmjs.com/package/stailwc
Apache License 2.0
230 stars 3 forks source link

Styles not applied if starting on very first line character #30

Closed henninghall closed 1 year ago

henninghall commented 1 year ago

Found another difference between className/twin.macro and stailwc.

If the style is starting on the very first character on a new line, it is not being applied. If adding one or more spaces or tabs it works as expected.

Screenshot 2023-02-20 at 22 37 59
    <div tw="grid grid-cols-2 m-8 border border-black">
      <div
        className="
bg-blue-200"
      >
        className / twin.macro
      </div>
      <div
        tw="
bg-blue-200"
      >
        tw (stailwc)
      </div>
    </div>
arlyon commented 1 year ago

Nice! I will release a patch version soon. I tend to have format-on-save so haven't hit these edge cases but it makes sense to have the parser support newlines if it is valid jsx

arlyon commented 1 year ago

Fix is here: https://github.com/arlyon/stailwc/commit/8be0b60c9c50df58176b4cdc30f9472cf20b34b9. My release process is a bit wacky ATM so I will not do a release just yet. Hoping to fix it later this week.

henninghall commented 1 year ago

Awesome thanks!