timonweb / django-tailwind

Django + Tailwind CSS = 💚
https://django-tailwind.readthedocs.io
MIT License
1.46k stars 92 forks source link

python3 manage.py tailwind start doesn't exit #46

Closed AliMejbar closed 3 years ago

AliMejbar commented 3 years ago

Hello, I noticed that "python3 manage.py tailwind start" doesn't exit after finish so i have to exit it it by Keyboard Interrupt (Ctrl + C) every time , its not that big of a deal since i just let it go for 20 seconds before interrupting it and it works but it would be better if it did automatically. Python : 3.8.5 django-tailwind : latest image

justinmayer commented 3 years ago

Hi @AliMejbar. What you described is the normal, expected behavior. Do you see the following parts in the output?

> watch 'npm run dev:sass && npm run dev:postcss' ./src

> Watching ./src

When you see words like "watch" and "watching", that indicates that the theme/static_src/src/ directory is being actively monitored for changes. So if you modify the styles.scss file within and save your changes, the dev server should notice those changes and re-compile the CSS. This is useful when you want to make those kinds of changes and get rapid feedback regarding the rendered output.

If you only want to do a one-off build, without automatic file watching + compilation, you probably instead want the following command:

python3 manage.py tailwind build

With the above command, you'll find you no longer need to use CTRL-C to exit the dev server. Hope this helps!

AliMejbar commented 3 years ago

Hi thank's for your answer seems like i misunderstood the role of the function i thought it was for compiling the CSS but without "cleaning it" with purge css kind of like python3 manage.py tailwind build but without that last step just for speed purpose (that's what i understood from the readme file) in this case can you tell me the correct command to do so if it exists ? Thank's in advance

justinmayer commented 3 years ago

I thought [tailwind start] was for compiling the CSS but without "cleaning it" with purge css kind of like python3 manage.py tailwind build but without that last step just for speed purpose

I don't think that understanding is correct. But start and build do indeed perform different functions. They are merely shortcuts to other commands, and you can see how those commands are different from the output when you run them.

As far as I know, there is no Django management command is like start but that exits without watching the files. Nor do I really see the point in having such a command. I think perhaps this issue description would have better been prefixed with a detailed description of your workflow and how/why the existing commands don't (seem) to fit your target workflow.

AliMejbar commented 3 years ago

I got it thank's for all of your help !

Ambro17 commented 3 years ago

I just had the same doubt, it's not immediately clear from the readme that the start command will watch files.