Search code examples
htmlcsstailwind-csscdn

Adding a class to a site published with the Tailwind CLI


When I create a site using the Tailwind CSS CLI, I know that only the classes I use are written to a file named output.css. When I want to make a change to the shared hosting website published with the obtained folder, I cannot because it is not monitored instantly (when I add a Tailwind class that I didn't use). Do I need to edit it locally and publish it every time for this process?

On the other hand, when I use Tailwind CSS CDN, everything works fine as I can include the entire library. But since the custom CSS and config settings I want to add will be in the head tag, it means that it must be read and run again on every page.


Solution

  • In the past time, I found a solution to the problem I shared above as follows.

    As I always do, I created the site using the Tailwindcss CLI and published it with its own files. If I want to make a change after publishing, I added the Tailwindcss CDN script to the header and included the Tailwindcss library. Thus, while the classes I use are in my current style.css file, I have added the ones I do not use with the help of CDN. There will be no conflict of classes because the classes I already use are in the style.css file. While I think that this solution will be useful for small-scale website projects, I would like to point out that it will be inefficient for large-scale projects.