✨ Feat: modernize CSS architecture#2819
Open
ZhenShuo2021 wants to merge 41 commits intonunocoracao:mainfrom
Open
✨ Feat: modernize CSS architecture#2819ZhenShuo2021 wants to merge 41 commits intonunocoracao:mainfrom
ZhenShuo2021 wants to merge 41 commits intonunocoracao:mainfrom
Conversation
added my personal website
Add new user
Bumps [rimraf](https://github.com/isaacs/rimraf) from 6.1.2 to 6.1.3. - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](isaacs/rimraf@v6.1.2...v6.1.3) --- updated-dependencies: - dependency-name: rimraf dependency-version: 6.1.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@iamtraction/google-translate](https://github.com/iamtraction/google-translate) from 1.1.2 to 2.0.1. - [Release notes](https://github.com/iamtraction/google-translate/releases) - [Commits](iamtraction/google-translate@v1.1.2...v2.0.1) --- updated-dependencies: - dependency-name: "@iamtraction/google-translate" dependency-version: 2.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
⚙️ Update Hugo supported version
…nd_yarn/dev/iamtraction/google-translate-2.0.1 📌 Bump @iamtraction/google-translate from 1.1.2 to 2.0.1
…nd_yarn/dev/rimraf-6.1.3 📌 Bump rimraf from 6.1.2 to 6.1.3
Bumps [mermaid](https://github.com/mermaid-js/mermaid) from 10.9.5 to 11.12.3. - [Release notes](https://github.com/mermaid-js/mermaid/releases) - [Commits](https://github.com/mermaid-js/mermaid/compare/v10.9.5...mermaid@11.12.3) --- updated-dependencies: - dependency-name: mermaid dependency-version: 11.12.3 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 24.37.2 to 24.37.5. - [Release notes](https://github.com/puppeteer/puppeteer/releases) - [Changelog](https://github.com/puppeteer/puppeteer/blob/main/CHANGELOG.md) - [Commits](puppeteer/puppeteer@puppeteer-v24.37.2...puppeteer-v24.37.5) --- updated-dependencies: - dependency-name: puppeteer dependency-version: 24.37.5 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.16.28 to 0.16.33. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.16.28...v0.16.33) --- updated-dependencies: - dependency-name: katex dependency-version: 0.16.33 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@tailwindcss/cli](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-cli) from 4.1.18 to 4.2.1. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.2.1/packages/@tailwindcss-cli) --- updated-dependencies: - dependency-name: "@tailwindcss/cli" dependency-version: 4.2.1 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
update users.json
…nd_yarn/dev/mermaid-11.12.3 📌 Bump mermaid from 10.9.5 to 11.12.3
…nd_yarn/dev/puppeteer-24.37.5 📌 Bump puppeteer from 24.37.2 to 24.37.5
…nd_yarn/dev/katex-0.16.33 📌 Bump katex from 0.16.28 to 0.16.33
…nd_yarn/dev/tailwindcss/cli-4.2.1 📌 Bump @tailwindcss/cli from 4.1.18 to 4.2.1
✅ Deploy Preview for snazzy-dango-efb2ec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3701ea3 to
ad067ec
Compare
- replace tailwind.config.js with config.css - adopt oklch color space instead of rgb number
the previous method has multiple restrictions
ad067ec to
d08d571
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2679
Closes #2766
Caution
This is a large PR with breaking changes.
This PR modernizes the theme's CSS architecture and aligns it with the current Tailwind ecosystem. The goal is not only to clean up technical debt, but also to make customization more intuitive and ensure the final CSS output remains predictable and consistent.
If accepted, perhaps we could include this PR in the beta release.
Benefits
For general users
For advanced users
css.TailwindCSSpipeline to automate Tailwind class generation.@applysyntax incustom.css([Feature]: Enable Tailwind @apply in custom.css to define reusable user classes #2679)!package.jsonmanagement.main.css,components/*.css, ortailwind.config.jssolely for Tailwind customization.For CSS output
Ensures Tailwind compiles correct and consistent CSS output.
Example:
.bg-neutral\/25 { /* it previously builds nested rgba color, and not using fallback for color-mix */ - background-color: color-mix(in srgb, rgba(rgba(var(--color-neutral), 1), 1) 25%, transparent); + background-color: var(--color-neutral); - @supports (color: color-mix(in lab, red, red)) { background-color: color-mix(in oklab, rgba(var(--color-neutral), 1) 25%, transparent); + @supports (color: color-mix(in lab, red, red)) { background-color: color-mix(in oklab, var(--color-neutral) 25%, transparent); } }Resolves multiple long-standing issues where CSS rules were generated but not actually effective.
What This PR Actually Changes
Color Variables
The most significant change is that color scheme variables now store actual color values instead of raw RGB numbers.
:root { - --color-neutral: 255, 255, 255; + --clr-neutral: rgb(255, 255, 255); }By supporting full color values rather than raw RGB numbers, colors can now be previewed directly within IDEs. This also enables support for the OKLCH color space, allowing more intuitive, perceptual color adjustments that are not possible with traditional RGB color space.
This update further streamlines integration with Tailwind colors and simplifies migration to the standard 11-level color scale (e.g., defining
--clr-XXX-950). Moving away from the previous non-standard 10-level system allows users to adopt advanced tooling such as tints.dev.The 11-level system also improves contrast depth, addressing the issue where the previous darkest level (900) lacked sufficient contrast, as noted in #2630.
Removal of
tailwind.config.jsTailwind v4 moves configuration into CSS rather than JavaScript. This PR removes
tailwind.config.jsand replaces it withconfig.css.New
headDirectoryHead-related partials are now organized under a dedicated
headdirectory.A new
css.htmlis introduced so advanced users can override it and usecss.TailwindCSSfor live class generation if needed.No migration is required, as existing extend points
extend-head.htmlandfavicons.htmlremain unchanged.New
tailwindDirectoryThe previous mixture of Tailwind CSS and plain CSS often caused confusion for both users and contributors. A dedicated
tailwinddirectory has been introduced to clearly isolate Tailwind-specific files and make the structure easier to understand and maintain.Miscellaneous
uid.htmlnow generates identical hashes for identical content.Migration
Custom Color Scheme
If using a custom color scheme, update variables as follows:
:root { - --color-neutral: 255, 255, 255; + --clr-neutral: rgb(255, 255, 255); }This can be processed efficiently in VS Code using regex find and replace: replace
color(-\w+-*\d*): (\d+, \d+, \d+)withclr$1: rgb($2).Optional Adjustments:
--clr-XXX-950for the three base colors to complete the 11-level scale.Custom CSS
If colors are referenced in
custom.css, update the syntax to remove the redundantrgb()wrapper:.foo { - color: rgb(var(--color-neutral)); + color: var(--clr-neutral); }Custom Tailwind Build
If managing a custom Tailwind configuration, update the command from:
to:
Notes on
css.TailwindCSSTo enable
css.TailwindCSS, add the required settings as described in the documentation, and replace the existing resource handling incss.htmlwith:{{/* Replace the following block: */}} {{/* {{ $cssResources = $cssResources | append (resources.Get "css/compiled/main.css") }} {{ with resources.Get "css/custom.css" }} {{ $cssResources = $cssResources | append . }} {{ end }} */}} {{/* With this Hugo Tailwind implementation: */}} {{ with (templates.Defer (dict "key" "global")) }} {{ partial "inline/TailwindCSS" . }} {{ end }} {{ define "_partials/inline/TailwindCSS" }} {{ with resources.Get "css/main.css" }} {{ $opts := dict "minify" (not hugo.IsDevelopment) }} {{ with . | css.TailwindCSS $opts }} {{ if hugo.IsDevelopment }} <link rel="stylesheet" href="{{ .RelPermalink }}" /> {{ else }} {{ with . | fingerprint }} <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" /> {{ end }} {{ end }} {{ end }} {{ end }} {{ end }}Finally, manage the packages in the project root with
npm install @tailwindcss/cli @tailwindcss/typography @tailwindcss/forms tailwind-scrollbar tailwindcss.css.TailwindCSSis not supported out-of-the-box due to Hugo's implementation differs from a standard Tailwind setup, providing official support would introduce significant maintenance overhead and potential issues. This remains an opt-in path for advanced use cases.