From f00bd1055d01efbf63fea519bfc0ff2f286879d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Idival?= Date: Mon, 4 May 2026 23:09:07 -0300 Subject: [PATCH] feat: replace Tailwind CDN with static CSS build (item 20) Multi-stage Dockerfile builds ~22KB minified CSS from Tailwind instead of loading ~300KB JS from CDN on every request. --- .gitignore | 4 ++++ Dockerfile | 15 ++++++++++++++- index.html | 42 +----------------------------------------- index.pt-br.html | 42 +----------------------------------------- input.css | 3 +++ tailwind.config.js | 39 +++++++++++++++++++++++++++++++++++++++ vs.html | 27 +-------------------------- vs.pt-br.html | 27 +-------------------------- 8 files changed, 64 insertions(+), 135 deletions(-) create mode 100644 input.css create mode 100644 tailwind.config.js diff --git a/.gitignore b/.gitignore index e43b0f9..852db04 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ .DS_Store +node_modules/ +output.css +package.json +package-lock.json diff --git a/Dockerfile b/Dockerfile index 1724689..8ae866d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,28 @@ +FROM node:20-alpine AS build +WORKDIR /build +COPY input.css tailwind.config.js ./ +COPY *.html ./ +RUN npx tailwindcss@3 -i input.css -o output.css --minify + FROM nginx:alpine ARG APP_URL=https://app.batida.io +COPY --from=build /build/output.css /usr/share/nginx/html/output.css COPY index.html /tmp/index.html COPY index.pt-br.html /tmp/index.pt-br.html +COPY vs.html /tmp/vs.html +COPY vs.pt-br.html /tmp/vs.pt-br.html RUN sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/index.html && \ sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/index.pt-br.html && \ + sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/vs.html && \ + sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/vs.pt-br.html && \ mkdir -p /usr/share/nginx/html/pt-br && \ mv /tmp/index.html /usr/share/nginx/html/index.html && \ - mv /tmp/index.pt-br.html /usr/share/nginx/html/pt-br/index.html + mv /tmp/index.pt-br.html /usr/share/nginx/html/pt-br/index.html && \ + mv /tmp/vs.html /usr/share/nginx/html/vs.html && \ + mv /tmp/vs.pt-br.html /usr/share/nginx/html/pt-br/vs.html COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/index.html b/index.html index 347df6d..9449897 100644 --- a/index.html +++ b/index.html @@ -29,47 +29,7 @@ - - - - +