-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REFACTOR] Clearly distinguish prod and development css (#4148)
After the discussion in #4102 and #4130, I will try to clean up the mess I made! Here is the new situation: * We now have two different scripts, `generate-prod-css` and `generate-development-css`. * These generate into two different files, `generated.full.css` and `generated.css`. The `generated.css` file is `gitignore`d. * Depending on whether we are in debug mode or not, the right file is referenced in the HTML. Hopefully, this will get rid of all the confusion surrounding the purpose of these files! @TiBiBa, @reedspool, what do you think?
- Loading branch information
Showing
15 changed files
with
32,040 additions
and
4,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
Tailwind for Hedy | ||
================= | ||
|
||
This directory contains the sources for Tailwind. Normally we'd include this in | ||
our build process, but our build process is minimal and Python-based, and we | ||
don't necessarily want to include NPM-based tooling into a Python build. | ||
This directory contains two scripts: | ||
|
||
That's why Tailwind CSS is periodically generated by hand, by running: | ||
|
||
``` | ||
$ tailwind/generate-css | ||
``` | ||
* `generate-prod-css`: gets run on deploy to generate minimal CSS which gets | ||
served on the real site. | ||
* `generate-development-css`: can be run by developers to regenerate the | ||
full development CSS file. You should almost never need to do this, just | ||
when you want to use Tailwind condition classes (like `hover:`, `group-hover:`, etc). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
#!/bin/bash | ||
# Generate a DEVELOPMENT copy of generated.css | ||
# | ||
# This is the version that should always be checked in. It is based on the FULL | ||
# Tailwind config, so that developers can always program against all classes without | ||
# having to worry about regenerating the CSS. | ||
# | ||
# At deployment time, we will use the stripping config build to make sure the generated | ||
# CSS file ends up small. | ||
set -eu | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
cd $scriptdir | ||
|
||
echo "👉 Generating CSS with all features enabled. This file's goan' be big!" >&2 | ||
|
||
staticdir=../../../static | ||
targetfile=generated.full.css | ||
|
||
npx tailwindcss build -c $scriptdir/tailwind.full.js -i styles.css -o $staticdir/css/generated.css | ||
npx minify $staticdir/css/generated.css > $staticdir/css/generated.css.min | ||
mv $staticdir/css/generated.css{.min,} | ||
if [[ "${1:-}" == "--watch" ]]; then | ||
echo "👀 Running Tailwind compilation in watch mode. 👀" | ||
npx tailwindcss build -c $scriptdir/tailwind.full.js -i styles.css -o $staticdir/css/$targetfile --watch | ||
else | ||
npx tailwindcss build -c $scriptdir/tailwind.full.js -i styles.css -o $staticdir/css/$targetfile | ||
# Not minifying on purpose, to reduce merge conflicts if this file ever changes | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -eu | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
cd $scriptdir | ||
|
||
staticdir=../../../static | ||
targetfile=generated.css | ||
|
||
if [[ "${1:-}" == "--watch" ]]; then | ||
echo "👀 Running Tailwind compilation in watch mode. 👀" | ||
npx tailwindcss build -c $scriptdir/tailwind.config.js -i styles.css -o $staticdir/css/$targetfile --watch | ||
else | ||
npx tailwindcss build -c $scriptdir/tailwind.config.js -i styles.css -o $staticdir/css/$targetfile | ||
npx minify $staticdir/css/$targetfile > $staticdir/css/$targetfile.min | ||
mv $staticdir/css/$targetfile{.min,} | ||
fi |
Oops, something went wrong.