Skip to content

Commit 7fb9a37

Browse files
authored
Add django-tailwind library and initial configuration. (#563)
1 parent cd3c9b9 commit 7fb9a37

File tree

16 files changed

+2183
-5028
lines changed

16 files changed

+2183
-5028
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,4 @@ bower_components
208208
assets/
209209
node_modules
210210

211-
djangosnippets/static/css/site.css
211+
theme/static/css/dist/styles.css

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ In a Python 3.11 virtual environment::
5050
$ cd requirements
5151
$ pip install -r development.txt
5252
$ cd ..
53+
$ python manage.py tailwind install
5354
$ python manage.py migrate
5455

5556
Now you can start the development server::
@@ -63,9 +64,9 @@ are included in the fixtures folder. Also included are five snippets to get you
6364
$ python manage.py createsuperuser
6465
$ python manage.py loaddata fixtures/cab.json
6566

66-
You will need to build the site.css with tailwindcss::
67+
To use Tailwind, you need to start the Tailwind server::
6768

68-
$ npm run build
69+
$ python manage.py tailwind start
6970

7071
Now you should be able to use the development version of djangosnippets
7172
on port 8000.

djangosnippets/settings/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def user_url(user):
6161
"comments_spamfighter",
6262
"ratings",
6363
"taggit",
64+
"tailwind",
65+
"theme",
6466
"django_recaptcha",
6567
"django_extensions",
6668
"rest_framework",
@@ -104,6 +106,7 @@ def user_url(user):
104106
STATIC_URL = "/assets/static/"
105107
STATIC_ROOT = os.path.join(PROJECT_ROOT, "..", "assets", "static")
106108
STATICFILES_DIRS = (os.path.join(PROJECT_ROOT, "static"),)
109+
TAILWIND_APP_NAME = "theme"
107110

108111
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
109112
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"

djangosnippets/static/tailwind/site.css

Lines changed: 0 additions & 22 deletions
This file was deleted.

djangosnippets/templates/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load static %}<!DOCTYPE html>
1+
{% load static tailwind_tags %}<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<title>djangosnippets: {% block head_title %}Home{% endblock %}</title>
@@ -7,9 +7,9 @@
77
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css">
88
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" />
99
<link rel="alternate" href="{% url 'cab_feed_latest' %}" type="application/atom+xml" title="Feed of latest snippets" />
10-
<link href="{% static "css/site.css" %}" rel="stylesheet">
1110
<link rel="stylesheet" href="{% static "css/main.css" %}" type="text/css" />
1211
{% block feeds %}{% endblock %}
12+
{% tailwind_css %}
1313
</head>
1414
<body class="{% block bodyclass %}{% endblock %}">
1515
<div id="accountbar"><div class="inner">

0 commit comments

Comments
 (0)