web/quotes: add tailwind
This commit is contained in:
parent
1fe4e04464
commit
ca27848285
16 changed files with 3047 additions and 7 deletions
|
@ -12,3 +12,4 @@ syntax: glob
|
|||
*.orig
|
||||
*~
|
||||
db.sqlite3
|
||||
node_modules/
|
||||
|
|
|
@ -20,5 +20,6 @@
|
|||
unifiHacked = import ./unifi-hack args;
|
||||
tiny-remapper = import ./tiny-remapper.nix args;
|
||||
django-allauth = pkgs.python3Packages.callPackage ./django-allauth.nix {};
|
||||
django-tailwind = pkgs.python3Packages.callPackage ./django-tailwind.nix {};
|
||||
} // (import ./heptapod-runner.nix args)
|
||||
// (import ./lightspeed args)
|
||||
|
|
21
nix/pkgs/django-tailwind.nix
Normal file
21
nix/pkgs/django-tailwind.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ stdenv, buildPythonPackage, fetchPypi, django }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "django-tailwind";
|
||||
version = "1.1.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256:12kxqsspkd0rdsb9rw46hvwfsd8af6qjjrpi1wprbmkf516ri9c4";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ django ];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Integration of Tailwind CSS with Django";
|
||||
homepage = "https://github.com/timonweb/django-tailwind";
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
|
@ -8,26 +8,57 @@ let
|
|||
(depot.pkgs.django-allauth.override {
|
||||
django = django_3;
|
||||
})
|
||||
(depot.pkgs.django-tailwind.override {
|
||||
django = django_3;
|
||||
})
|
||||
]);
|
||||
|
||||
filterSourcePred = (path: type: type != "directory" || (
|
||||
baseNameOf path != "__pycache__" &&
|
||||
baseNameOf path != "node_modules" &&
|
||||
true));
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation rec {
|
||||
name = "quotes";
|
||||
|
||||
src = ./.;
|
||||
src = builtins.filterSource filterSourcePred ./.;
|
||||
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
buildInputs = with pkgs; [ makeWrapper nodejs ];
|
||||
propagatedBuildInputs = [ python ];
|
||||
|
||||
buildPhase = "true";
|
||||
nodeModules = pkgs.stdenvNoCC.mkDerivation rec {
|
||||
name = "quotes-node_modules";
|
||||
src = builtins.filterSource filterSourcePred ./theme/static_src;
|
||||
|
||||
outputHash = "sha256:07w8fzy7i7vikfmazx9kbrhf503qabsbhibmyasvpqjwb2r9gm0a";
|
||||
outputHashMode = "recursive";
|
||||
|
||||
buildInputs = with pkgs; [ nodejs ];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir $NIX_BUILD_TOP/tmp
|
||||
export HOME=$NIX_BUILD_TOP/tmp
|
||||
npm i
|
||||
'';
|
||||
installPhase = ''
|
||||
cp -R node_modules $out
|
||||
'';
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
cp -R $nodeModules theme/static_src/node_modules
|
||||
'';
|
||||
installPhase = ''
|
||||
sitepkgdir="$out/lib/${python.libPrefix}/site-packages"
|
||||
pkgdir="$sitepkgdir/quotes"
|
||||
mkdir -p $pkgdir
|
||||
cp -R \
|
||||
$src/quotesapp \
|
||||
$src/quotedb \
|
||||
$src/templates \
|
||||
$src/static \
|
||||
quotesapp \
|
||||
quotedb \
|
||||
templates \
|
||||
static \
|
||||
discordguild \
|
||||
theme \
|
||||
$pkgdir
|
||||
|
||||
mkdir "$out/bin"
|
||||
|
@ -42,7 +73,11 @@ pkgs.stdenvNoCC.mkDerivation rec {
|
|||
export STATIC_ROOT="$out/share/static"
|
||||
export DJANGO_SETTINGS_MODULE=quotes.quotesapp.settings
|
||||
export PYTHONPATH=$PYTHONPATH''${PYTHONPATH:+':'}"$sitepkgdir"
|
||||
django-admin tailwind build
|
||||
django-admin collectstatic --no-input
|
||||
|
||||
chmod -R +w $pkgdir/theme/static $pkgdir/theme/static_src
|
||||
rm -rf $pkgdir/theme/static $pkgdir/theme/static_src
|
||||
'';
|
||||
|
||||
passthru.pythonEnv = python;
|
||||
|
|
|
@ -41,13 +41,17 @@ INSTALLED_APPS = [
|
|||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.sites",
|
||||
"tailwind",
|
||||
"allauth",
|
||||
"allauth.account",
|
||||
"allauth.socialaccount",
|
||||
"quotes.quotedb",
|
||||
"quotes.discordguild",
|
||||
"quotes.theme",
|
||||
]
|
||||
|
||||
TAILWIND_APP_NAME = "quotes.theme"
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
|
|
|
@ -6,6 +6,7 @@ let
|
|||
in pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
quotes.pythonEnv
|
||||
nodejs
|
||||
|
||||
black
|
||||
];
|
||||
|
|
2
web/quotes/templates/base.html
Normal file
2
web/quotes/templates/base.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
|
0
web/quotes/theme/__init__.py
Normal file
0
web/quotes/theme/__init__.py
Normal file
5
web/quotes/theme/apps.py
Normal file
5
web/quotes/theme/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ThemeConfig(AppConfig):
|
||||
name = 'theme'
|
1
web/quotes/theme/static/css/styles.css
Normal file
1
web/quotes/theme/static/css/styles.css
Normal file
|
@ -0,0 +1 @@
|
|||
/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::after,::before{box-sizing:border-box}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}body{font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji'}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset{margin:0;padding:0}ol,ul{list-style:none;margin:0;padding:0}html{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";line-height:1.5}body{font-family:inherit;line-height:inherit}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#9ca3af}input::placeholder,textarea::placeholder{color:#9ca3af}button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.flex{display:flex}.table{display:table}.items-center{align-items:center}.justify-center{justify-content:center}.font-serif{font-family:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif}.h-screen{height:100vh}.text-5xl{font-size:3rem;line-height:1}.leading-normal{line-height:1.5}.mx-auto{margin-left:auto;margin-right:auto}.static{position:static}*{--tw-shadow:0 0 #0000}*{--tw-ring-inset:var(--tw-empty, );/*!*//*!*/--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59, 130, 246, 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000}.tracking-normal{letter-spacing:0}@-webkit-keyframes spin{to{transform:rotate(360deg)}}@keyframes spin{to{transform:rotate(360deg)}}@-webkit-keyframes ping{100%,75%{transform:scale(2);opacity:0}}@keyframes ping{100%,75%{transform:scale(2);opacity:0}}@-webkit-keyframes pulse{50%{opacity:.5}}@keyframes pulse{50%{opacity:.5}}@-webkit-keyframes bounce{0%,100%{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@keyframes bounce{0%,100%{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}
|
2882
web/quotes/theme/static_src/package-lock.json
generated
Normal file
2882
web/quotes/theme/static_src/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
29
web/quotes/theme/static_src/package.json
Normal file
29
web/quotes/theme/static_src/package.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "django_tailwind",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"start": "npm run dev",
|
||||
"build": "npm run build:clean && npm run build:sass && npm run build:postcss && npm run build:cleancss",
|
||||
"build:clean": "rimraf ../static/css",
|
||||
"build:sass": "node-sass --output-style compressed src/styles.scss ../static/css/styles.css",
|
||||
"build:postcss": "NODE_ENV=production postcss --config . --map false --output ../static/css/styles.css ../static/css/styles.css",
|
||||
"build:cleancss": "cleancss -o ../static/css/styles.css ../static/css/styles.css",
|
||||
"dev": "watch \"npm run dev:sass && npm run dev:postcss\" ./src",
|
||||
"dev:sass": "node-sass --output-style expanded --source-map true src/styles.scss ../static/css/styles.css",
|
||||
"dev:postcss": "postcss --config . --map true --output ../static/css/styles.css ../static/css/styles.css"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.0.2",
|
||||
"clean-css-cli": "^4.3.0",
|
||||
"node-sass": "^5.0.0",
|
||||
"postcss": "^8.1.9",
|
||||
"postcss-cli": "^8.3.0",
|
||||
"postcss-scss": "^3.0.4",
|
||||
"rimraf": "^3.0.2",
|
||||
"tailwindcss": "^2.0.1",
|
||||
"watch": "^1.0.2"
|
||||
}
|
||||
}
|
6
web/quotes/theme/static_src/postcss.config.js
Normal file
6
web/quotes/theme/static_src/postcss.config.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
3
web/quotes/theme/static_src/src/styles.scss
Normal file
3
web/quotes/theme/static_src/src/styles.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
20
web/quotes/theme/static_src/tailwind.config.js
Normal file
20
web/quotes/theme/static_src/tailwind.config.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
// 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 = {
|
||||
purge: [
|
||||
// Templates within theme app (e.g. base.html)
|
||||
'../templates/**/*.html',
|
||||
// Templates in other apps. Uncomment the following line if it matches
|
||||
// your project structure or change it to match.
|
||||
// '../../templates/**/*.html',
|
||||
],
|
||||
darkMode: false, // or 'media' or 'class'
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
29
web/quotes/theme/templates/base.html
Normal file
29
web/quotes/theme/templates/base.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Tailwind CSS Skeleton</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||
</head>
|
||||
|
||||
<body class="bg-grey-lightest font-serif leading-normal tracking-normal">
|
||||
|
||||
<div class="container mx-auto">
|
||||
<section class="flex items-center justify-center h-screen">
|
||||
<h1 class="text-5xl">Django + Tailwind = ❤️</h1>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue