chore: purge tailwind classes (resolve #22)

This commit is contained in:
Ferdinand Mütsch 2021-02-21 11:14:55 +01:00
parent 218c93e975
commit 701ed0a3e1
5 changed files with 1235 additions and 2 deletions

View File

@ -249,6 +249,15 @@ However, if you want to expose your wakapi instance to the public anyway, you ne
CGO_FLAGS="-g -O2 -Wno-return-local-addr" go test -json -coverprofile=coverage/coverage.out ./... -run ./...
```
### Building Tailwind
To keep things minimal, Wakapi does not contain a `package.json`, `node_modules` or any sort of frontend build step. Instead, all JS and CSS assets are included as static files and checked in to Git. This way we can avoid requiring NodeJS to build Wakapi. However, for [TailwindCSS](https://tailwindcss.com/docs/installation#building-for-production) it makes sense to run it through a "build" step to benefit from purging and significantly reduce it in size. To only require this at the time of development, the compiled asset is checked in to Git as well.
```bash
$ npm install -g tailwindcss-cli
$ wget -O /tmp/tailwind.css https://unpkg.com/tailwindcss@^2/dist/tailwind.css
$ tailwindcss-cli build /tmp/tailwind.css -o static/assets/vendor/tailwind.dist.css
```
## 🙏 Support
If you like this project, please consider supporting it 🙂. You can donate either through [buying me a coffee](https://buymeacoff.ee/n1try) or becoming a GitHub sponsor. Every little donation is highly appreciated and boosts the developers' motivation to keep improving Wakapi!

1218
static/assets/vendor/tailwind.dist.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
tailwind.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
purge: {
enabled: true,
mode: 'all',
content: ['./views/*.tpl.html']
}
}

View File

@ -7,6 +7,6 @@
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png">
<link rel="manifest" href="assets/site.webmanifest">
<link href="assets/vendor/roboto.css" rel="stylesheet">
<link href="assets/vendor/tailwind.min.css" rel="stylesheet">
<link href="assets/vendor/tailwind.dist.css" rel="stylesheet">
<link href="assets/app.css" rel="stylesheet">
</head>