简体   繁体   English

使用 Tailwind CSS 和 Django 的概述?

[英]An overview of using Tailwind CSS with Django?

I was looking for some overview information on using Tailwind CSS with Django.我正在寻找一些关于使用 Tailwind CSS 和 Django 的概述信息。

I found this excellent thread, and I followed the first answer to install Tailwind ready for use with Django: How to use TailwindCSS with Django?我找到了这个优秀的线程,然后我按照第一个答案安装 Tailwind,准备与 Django 一起使用: 如何将 TailwindCSS 与 Django 一起使用?

I understand that Tailwind is a CSS framework, that will help you manage your CSS/rendering and related resources.我了解 Tailwind 是一个 CSS 框架,它将帮助您管理 CSS/渲染和相关资源。 But I am confused as to how Tailwind and Django can fit together.但我对 Tailwind 和 Django 如何组合在一起感到困惑。 For example:例如:

  1. What is the purpose of the PyPi project django-tailwind, and is it necessary? PyPi 项目 django-tailwind 的目的是什么,有必要吗?
  2. How does Tailwind fit in with Django forms and the render as "p" or render as "table", ie is there an alternative way to style Django forms, or will Tailwind work well with these? How does Tailwind fit in with Django forms and the render as "p" or render as "table", ie is there an alternative way to style Django forms, or will Tailwind work well with these?
  3. Any other "overview" information on this topic?关于这个主题的任何其他“概述”信息?

This is quite easy if you want to use tailwind css in your project.如果您想在项目中使用顺风 css,这非常容易。 An easier method is by using the cdn.更简单的方法是使用cdn。 just add it in the head tags at the top of the page like this:只需将其添加到页面顶部的 head 标签中,如下所示:

<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.0.2/tailwind.min.css" rel="stylesheet">

And then you could use the classes and it should work well.然后你可以使用这些类,它应该工作得很好。

You can use Crispy-Tailwind https://github.com/django-crispy-forms/crispy-tailwind您可以使用 Crispy-Tailwind https://github.com/django-crispy-forms/crispy-tailwind

but is on early stages of development但处于早期发展阶段

otherwise yo can follow this awesome example https://github.com/timonweb/django-tailwind否则你可以按照这个很棒的例子https://github.com/timonweb/django-tailwind

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM