Use tailwind cli to compile css instead of tailwind cdn (#132)

* implement feature
* use npm instead of cli
This commit is contained in:
Tricked
2025-10-18 13:47:59 +02:00
committed by Christiaan Goossens
parent 653c716ea8
commit 9bf2372b7e
7 changed files with 1153 additions and 3 deletions

7
.gitignore vendored
View File

@@ -107,4 +107,9 @@ dmypy.json
# End of https://www.gitignore.io/api/python
config/
.venv
.venv
.pytest_logs.log
node_modules

View File

@@ -24,6 +24,12 @@ Some useful scripts are in the `scripts` directory. If you run Linux (or WSL und
You can also run these commands manually on Windows:
##### Compiling css
To compile tailwind css styles for the pages you need the NodeJS and NPM installed.
You can run the `npm run css` script to generate the css once and you can run the `npm run css:watch` to recompile the css every time the templates change
##### Check
```
uv run ruff check

View File

@@ -0,0 +1,3 @@
@import "tailwindcss";
@source "../views/templates";

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}{% endblock %}</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="/auth/oidc/static/style.css">
{% endblock %}
</head>
@@ -16,4 +16,4 @@
</div>
</body>
</html>
</html>

1123
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "hass-oidc-auth",
"scripts": {
"css": "tailwindcss -i ./custom_components/auth_oidc/static/input.css -o ./custom_components/auth_oidc/static/style.css --minify",
"css:watch": "tailwindcss -i ./custom_components/auth_oidc/static/input.css -o ./custom_components/auth_oidc/static/style.css --watch --minify"
},
"dependencies": {
"@tailwindcss/cli": "^4.1.14",
"tailwindcss": "^4.1.14"
}
}