epicserve / django-base-site

The Django Base Site is a Django site that is built using the best Django practices and comes with all the common Django packages that you need to jumpstart your next project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tailwind CSS

lcfd opened this issue · comments

Hi, given its popularity, adding support to Tailwind could be a winning move.

It's just a suggestion and anyway it can be added later using this application https://github.com/timonweb/django-tailwind

But I'm curious to know what you think and if it can be feasible.

👋

Hi @lcfd,

Thank you for your suggestion! I've thought about this, and it looks like three years ago, I started a branch to experiment with the idea.

So here are some initial thoughts and ideas:

  1. Build frontend framework templates that you could use to choose from when you run the install script. Then I could have people volunteer to maintain that framework. This wouldn't be that easy because you would have to design a way for the framework to be swapped out. Also, this would need to change the python requirements because you would probably need to install a different template pack for django-crispy-forms. You would also need different Django Templates for the views in the accounts app. I'm also not sure if Tailwind works with Vite, so you might need to swap out Vite for PostCSS.

  2. Document how to switch out the default Bootstrap framework and have people create blog posts about it.

For me personally, Tailwind isn't something I want as the default framework, especially now that new versions of Bootstrap have added a lot of the Tailwind utility classes and, more recently, have added dark mode. I'm still open to the idea and willing to consider it, though, so I'll leave this open for a while and see what other people have to say.

I’m also interested in an alternate front end setup (postcss with some plugins). I did play around with it a little, but I ran into some strange issues trying to alias npm modules in the same way that you did with Bootstrap - in the end I ran into issues just trying to import the plugins to the vite.config.js file (kept seeing the error that the module could not be found). I’d be willing to do a PR if you can offer some guidance on the front end setup (I’m a little weak on the vite config and node troubleshooting.

Either way, thanks for this - it’s a fantastic Django starter, and I’ll be trying it on my next project!

@tobyl,

An excellent first step would be to fork the project, create a branch, and start hacking away to get Tailwind working with Vite. Then start updating all the account views like change password, change name, etc. Once that's done, we can look at the diff or PR and see what would be involved in switching things out. From there, we could decide and figure out how to update the install script so that people could choose what frontend framework they want to use. For every new frontend framework that the Django Base Site supports, we could update the tests to test installing that framework option, pulling the code from the person's repository that wants to support the frontend framework.