Add the TailwindCSS.

main
KKlochko 2 years ago
parent 7797387d91
commit 5e6adff80e

@ -5,4 +5,6 @@
Add simple tasks app. Add simple tasks app.
** 0.2.1 <2023-07-12 Wed> ** 0.2.1 <2023-07-12 Wed>
Add the tasks to be shown on the index page. Add the tasks to be shown on the index page.
** 0.2.2 <2023-07-12 Wed>
Add the TailwindCSS.

@ -0,0 +1,8 @@
asgiref==3.7.2
crispy-tailwind==0.5.0
Django==4.2.3
django-crispy-forms==2.0
django-tailwind==3.6.0
python-dotenv==1.0.0
sqlparse==0.4.4
typing_extensions==4.7.1

@ -20,6 +20,9 @@ DEBUG = os.environ.get('DEBUG')
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []
INTERNAL_IPS = [
"127.0.0.1",
]
# Application definition # Application definition
@ -31,6 +34,9 @@ INSTALLED_APPS = [
"django.contrib.sessions", "django.contrib.sessions",
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
"tailwind",
"crispy_forms",
"crispy_tailwind",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -93,6 +99,9 @@ AUTH_PASSWORD_VALIDATORS = [
}, },
] ]
if DEBUG:
INSTALLED_APPS.append("django_browser_reload")
MIDDLEWARE.append("django_browser_reload.middleware.BrowserReloadMiddleware")
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/ # https://docs.djangoproject.com/en/4.2/topics/i18n/
@ -105,6 +114,11 @@ USE_I18N = True
USE_TZ = True USE_TZ = True
TAILWIND_APP_NAME = 'tasks'
CRISPY_ALLOWED_TEMPLATE_PACKS = "tailwind"
CRISPY_TEMPLATE_PACK = "tailwind"
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/ # https://docs.djangoproject.com/en/4.2/howto/static-files/

@ -1,8 +1,12 @@
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from .settings import DEBUG
urlpatterns = [ urlpatterns = [
path('', include('tasks.urls')), path('', include('tasks.urls')),
path("admin/", admin.site.urls), path("admin/", admin.site.urls),
] ]
if DEBUG:
urlpatterns.append(path("__reload__/", include("django_browser_reload.urls")))

@ -0,0 +1 @@
node_modules

File diff suppressed because it is too large Load Diff

@ -0,0 +1,29 @@
{
"name": "tasks",
"version": "3.6.0",
"description": "",
"scripts": {
"start": "npm run dev",
"build": "npm run build:clean && npm run build:tailwind",
"build:clean": "rimraf ../static/css/dist",
"build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify",
"dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w",
"tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.4",
"@tailwindcss/typography": "^0.5.9",
"cross-env": "^7.0.3",
"postcss": "^8.4.24",
"postcss-import": "^15.1.0",
"postcss-nested": "^6.0.1",
"postcss-simple-vars": "^7.0.1",
"rimraf": "^5.0.1",
"tailwindcss": "^3.3.2"
}
}

@ -0,0 +1,7 @@
module.exports = {
plugins: {
"postcss-import": {},
"postcss-simple-vars": {},
"postcss-nested": {}
},
}

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@ -0,0 +1,58 @@
/**
* This is a minimal config.
*
* If you need the full config, get it from here:
* https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js
*/
module.exports = {
content: [
/**
* HTML. Paths to Django template files that will contain Tailwind CSS classes.
*/
/* Templates within theme app (<tailwind_app_name>/templates), e.g. base.html. */
'../../templates/**/*.html',
/*
* Main templates directory of the project (BASE_DIR/templates).
* Adjust the following line to match your project structure.
*/
'../../../templates/**/*.html',
/*
* Templates in other django apps (BASE_DIR/<any_app_name>/templates).
* Adjust the following line to match your project structure.
*/
'../../../**/templates/**/*.html',
/**
* JS: If you use Tailwind CSS in JavaScript, uncomment the following lines and make sure
* patterns match your project structure.
*/
/* JS 1: Ignore any JavaScript in node_modules folder. */
// '!../../**/node_modules',
/* JS 2: Process all JavaScript files in the project. */
// '../../**/*.js',
/**
* Python: If you use Tailwind CSS classes in Python, uncomment the following line
* and make sure the pattern below matches your project structure.
*/
// '../../**/*.py'
],
theme: {
extend: {},
},
plugins: [
/**
* '@tailwindcss/forms' is the forms plugin that provides a minimal styling
* for forms. If you don't like it or have own styling for forms,
* comment the line below to disable '@tailwindcss/forms'.
*/
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
require('@tailwindcss/line-clamp'),
require('@tailwindcss/aspect-ratio'),
],
}

@ -1,9 +1,10 @@
{% load static %} {% load static tailwind_tags %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{% tailwind_css %}
<title>{% block title %}Simple TODO List{% endblock %}</title> <title>{% block title %}Simple TODO List{% endblock %}</title>
</head> </head>
<body> <body>

Loading…
Cancel
Save