Skip to content

Commit 1502d9f

Browse files
committed
Add django-tailwind library and initial configuration.
1 parent cd3c9b9 commit 1502d9f

File tree

11 files changed

+2183
-3
lines changed

11 files changed

+2183
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,4 @@ assets/
209209
node_modules
210210

211211
djangosnippets/static/css/site.css
212+
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/templates/base.html

Lines changed: 2 additions & 1 deletion
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>
@@ -10,6 +10,7 @@
1010
<link href="{% static "css/site.css" %}" rel="stylesheet">
1111
<link rel="stylesheet" href="{% static "css/main.css" %}" type="text/css" />
1212
{% block feeds %}{% endblock %}
13+
{% tailwind_css %}
1314
</head>
1415
<body class="{% block bodyclass %}{% endblock %}">
1516
<div id="accountbar"><div class="inner">

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ django-generic-aggregation==0.4.0
88
django-ratelimit-backend==2.0
99
django-recaptcha==4.1.0
1010
django-taggit==5.0.1
11+
django-tailwind==4.0.1
1112
ipython==7.33.0
1213
Markdown==3.4.4
1314
Pillow==9.1.0

theme/__init__.py

Whitespace-only changes.

theme/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ThemeConfig(AppConfig):
5+
name = 'theme'

theme/static_src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

0 commit comments

Comments
 (0)