frostming / lektor-tailwind

A Lektor plugin that adds Tailwind CSS to your project seamlessly
MIT License
12 stars 3 forks source link

Do not overwrite compiled stylesheet when source changes #3

Closed dairiki closed 1 year ago

dairiki commented 1 year ago

First off, lektor-tailwind is great! Thank you!

One issue I've stumbled across:

The input CSS file is in the assets tree, called (by default) style.css. Tailwind compiles this to a CSS file in the output directory, also called style.css. When running Lektor in server mode, if the input style.css is edited, Lektor naturally copies the updated asset to the output directory. The problem is that this overwrites the compiled Tailwind output file of the same name.

Here is a fix. It's a little kludgy — it monkey-patches Lektor's build program for the CSS file to prevent it from copying the input CSS — but it works for me.

dairiki commented 1 year ago

I have now added a test that exercises the issue. (In so doing, I've converted the basic test in run_test.sh to a pytest test.)

frostming commented 1 year ago

Awesome PR, thanks