-
Notifications
You must be signed in to change notification settings - Fork 97
Tailwind optimize for production #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think out of the box with It looks like maybe the A proof of concept POSIX compliant script would be creating a file called #!/usr/bin/env sh
TAILWINDCSS_PROD_ARGS=
if [ "${NODE_ENV}" = "production" ]; then
TAILWINDCSS_PROD_ARGS="--minify"
fi
tailwindcss \
-i ./app/assets/stylesheets/application.tailwind.css \
-o ./app/assets/builds/application.css "${TAILWINDCSS_PROD_ARGS}" And then you'd call it with It's an interesting design problem because on one hand we want the conventions of Rails. On the other hand if this were implemented at the Ruby level then the idea of using standard TailwindCSS / vendor config files goes out the window. Looking forward to seeing what DHH comes up with as a unified plan for handling dev vs prod settings for both CSS and JS. By the way there's also https://tailwindcss.com/docs/optimizing-for-production. If you're using PostCSS you can install |
I think we should just pass --minify for both environments. It's fine to run minified in development too. |
Here is a workaround using Environment Variables:
|
Added --minify as the default instruction. IMO, no reason not to run this in development as well. |
The Tailwind docs specify that the CSS build can be minified to obtain the smallest possible CSS file.
You can minify your CSS by adding the
--minify
flag:If no preprocessor is being used (like sass), adding this flag would result in a smaller CSS file.
Unless rails has a css minifying step that I'm not aware of, we could add this to
css-bundling-rails
gem?The text was updated successfully, but these errors were encountered: