django-tailwind-cli icon indicating copy to clipboard operation
django-tailwind-cli copied to clipboard

Request: "remove_cli" command

Open danjac opened this issue 1 year ago • 2 comments

Hi, thanks first of all for a great utility!

I was wondering if it would be possible to have a Django command equivalent to download_cli, which would remove the CLI using the same path resolution i.e.

./manage.py tailwind remove_cli

This would be useful for example when building a Docker image, where you might build the Tailwind CSS and then remove the CLI, as you no longer need it in production and you want to keep the image as small as possible.

danjac avatar Sep 20 '24 10:09 danjac

@danjac This sounds like a reasonable addition. But I would suggest solving this using a multi-stage build. I wrote my approach in my latest blog post.

https://andrich.me/2024/09/my-ideal-uv-based-dockerfile/

Look at stage 3 and 4. In stage for, I use the tailwind command to compile my CSS. In stage 4, I assemble the production container. The trick is, that between stage 3 and 4 only the relevant files that you need in production are copied.

But I will consider your request. Nevertheless, you are welcome to provide a pull request.

oliverandrich avatar Sep 20 '24 12:09 oliverandrich

Sure - multistage build worked for my use case as well.

It might still be useful to have a remove_cli command for some edge cases I guess but certainly not a priority.

Thanks again!

danjac avatar Sep 20 '24 18:09 danjac