Skip to content

Commit

Permalink
chore: proper version control of Tailwind
Browse files Browse the repository at this point in the history
It was a mistake of me to not insist on proper version control
of Tailwind from the start.

The result was that the colors subtly changed between v1 and v2 of
Tailwind, and the whole website would be styled to the colors of
the version of Tailwind that the last person to run `generate-css`
happened to have on their machine.

That's not great!

Instead, now do proper version control by using `package.json`,
and control the version of Tailwind we use.

For now, we settle on Tailwind v1, because it has the colors we
want. We could eventually decide to move to Tailwind v2, if we find
a way to restore the old colors.

For now, there doesn't seem to be a pressing reason to upgrade, so
this is the simplest way to get the result we want. We can always
consciously decide to upgrade later.
  • Loading branch information
rix0rrr committed Apr 24, 2021
1 parent e1bd1b1 commit b776678
Show file tree
Hide file tree
Showing 5 changed files with 2,587 additions and 16 deletions.
2 changes: 1 addition & 1 deletion static/css/generated.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tailwind/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 6 additions & 15 deletions tailwind/generate-css
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
#!/bin/bash
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
cd $scriptdir

if ! which tailwindcss > /dev/null; then
echo "This script needs Tailwind installed." >&2
echo "Run 'npm install -g tailwindcss autoprefixer postcss' and try again." >&2
exit 1
fi
# Install the dependencies at the versions indicated by package.json and package-lock.json
npm ci

if ! which minify > /dev/null; then
echo "This script needs minify installed." >&2
echo "Run 'npm install -g minify' and try again." >&2
exit 1
fi

cd $(dirname $0)

tailwindcss build styles.css -o ../static/css/generated.css
minify ../static/css/generated.css > ../static/css/generated.css.min
npx tailwindcss build styles.css -o ../static/css/generated.css
npx minify ../static/css/generated.css > ../static/css/generated.css.min
mv ../static/css/generated.css{.min,}
Loading

0 comments on commit b776678

Please sign in to comment.