fix: pre-compile Tailwind CSS and track vendor libs (#88)
Replace 398KB Tailwind Play Mode runtime (not for production) with 37KB pre-compiled CSS. Fix .gitignore so web/lib/ vendor files (Tailwind CSS, ViewerJS) are tracked — fresh clones were completely broken without them. - Add gitignore negation rules for web/lib/ - Compile Tailwind v3.4.17 CSS at dev time via standalone CLI - Replace <script> tags with <link> in admin, gallery, metadata HTML - Delete tailwind.js runtime (no longer needed) - Add Makefile with css/css-watch/css-setup targets for devs - Track ViewerJS vendor files (viewer.min.js, viewer.min.css)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# Tailwind standalone CLI (downloaded by `make css-setup`)
|
||||
tailwindcss
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
@@ -16,6 +19,8 @@ eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
!web/lib/
|
||||
!web/lib/**
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
TAILWIND_VERSION := 3.4.17
|
||||
TAILWIND_CLI := ./tailwindcss
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
ifeq ($(UNAME_M),arm64)
|
||||
TAILWIND_PLATFORM := tailwindcss-macos-arm64
|
||||
else
|
||||
TAILWIND_PLATFORM := tailwindcss-macos-x64
|
||||
endif
|
||||
else
|
||||
ifeq ($(UNAME_M),aarch64)
|
||||
TAILWIND_PLATFORM := tailwindcss-linux-arm64
|
||||
else
|
||||
TAILWIND_PLATFORM := tailwindcss-linux-x64
|
||||
endif
|
||||
endif
|
||||
|
||||
TAILWIND_URL := https://github.com/tailwindlabs/tailwindcss/releases/download/v$(TAILWIND_VERSION)/$(TAILWIND_PLATFORM)
|
||||
|
||||
.PHONY: css css-watch css-setup clean-css
|
||||
|
||||
## Download Tailwind standalone CLI (dev only, not committed)
|
||||
css-setup:
|
||||
@if [ ! -f $(TAILWIND_CLI) ]; then \
|
||||
echo "Downloading Tailwind CSS v$(TAILWIND_VERSION) CLI..."; \
|
||||
curl -sLo $(TAILWIND_CLI) $(TAILWIND_URL) && chmod +x $(TAILWIND_CLI); \
|
||||
else \
|
||||
echo "Tailwind CLI already present"; \
|
||||
fi
|
||||
|
||||
## Rebuild compiled CSS (run after changing Tailwind classes in HTML/JS)
|
||||
css: css-setup
|
||||
$(TAILWIND_CLI) -i web/lib/tailwind/input.css -o web/lib/tailwind/styles.css --minify
|
||||
|
||||
## Watch mode for development
|
||||
css-watch: css-setup
|
||||
$(TAILWIND_CLI) -i web/lib/tailwind/input.css -o web/lib/tailwind/styles.css --watch
|
||||
|
||||
## Remove downloaded CLI binary
|
||||
clean-css:
|
||||
rm -f $(TAILWIND_CLI)
|
||||
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
content: ["./web/**/*.html", "./web/js/**/*.js"],
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
gray: { 850: '#1f2937', 875: '#1a202c', 925: '#0f172a' }
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
+1
-17
@@ -4,25 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PromptManager - Admin Dashboard</title>
|
||||
<script src="lib/tailwind/tailwind.js"></script>
|
||||
<link rel="stylesheet" href="lib/tailwind/styles.css">
|
||||
<link rel="stylesheet" href="lib/viewerjs/viewer.min.css">
|
||||
<script src="lib/viewerjs/viewer.min.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
gray: {
|
||||
850: '#1f2937',
|
||||
875: '#1a202c',
|
||||
925: '#0f172a'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.custom-scrollbar::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
|
||||
+1
-17
@@ -4,25 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PromptManager - Gallery</title>
|
||||
<script src="lib/tailwind/tailwind.js"></script>
|
||||
<link rel="stylesheet" href="lib/tailwind/styles.css">
|
||||
<link rel="stylesheet" href="lib/viewerjs/viewer.min.css">
|
||||
<script src="lib/viewerjs/viewer.min.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
gray: {
|
||||
850: '#1f2937',
|
||||
875: '#1a202c',
|
||||
925: '#0f172a'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.custom-scrollbar::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
File diff suppressed because one or more lines are too long
Vendored
+9
File diff suppressed because one or more lines are too long
Vendored
+10
File diff suppressed because one or more lines are too long
+1
-1
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Image Gallery - Generation Data</title>
|
||||
<script src="lib/tailwind/tailwind.js"></script>
|
||||
<link rel="stylesheet" href="lib/tailwind/styles.css">
|
||||
<style>
|
||||
/* Ensure the layout takes full height and prevents overflow */
|
||||
html, body {
|
||||
|
||||
Reference in New Issue
Block a user