Skip to content
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

Add tailwindcss #29357

Merged
merged 19 commits into from
Feb 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move colors calculation inline
  • Loading branch information
silverwind committed Feb 24, 2024
commit d9b52168ecb082bb52461d84b87cfabc6f8f2677
15 changes: 9 additions & 6 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import {readFileSync} from 'node:fs';
import {parse} from 'css-variables-parser';

const colors = Object.keys(parse([
readFileSync(new URL('web_src/css/themes/theme-gitea-light.css', import.meta.url), 'utf8'),
readFileSync(new URL('web_src/css/themes/theme-gitea-dark.css', import.meta.url), 'utf8'),
].join('\n'), {})).filter((prop) => prop.startsWith('color-')).map((prop) => prop.substring(6));

export default function ({isProduction}) {
return {
prefix: 'tw-',
Expand All @@ -25,7 +20,15 @@ export default function ({isProduction}) {
theme: {
colors: {
// make `tw-bg-red` etc work with our CSS variables
...Object.fromEntries(colors.map((color) => [color, `var(--color-${color})`])),
...Object.fromEntries(
Object.keys(parse([
readFileSync(new URL('web_src/css/themes/theme-gitea-light.css', import.meta.url), 'utf8'),
readFileSync(new URL('web_src/css/themes/theme-gitea-dark.css', import.meta.url), 'utf8'),
].join('\n'), {})).filter((prop) => prop.startsWith('color-')).map((prop) => {
const color = prop.substring(6);
return [color, `var(--color-${color})`];
})
),
inherit: 'inherit',
currentcolor: 'currentcolor',
transparent: 'transparent',
Expand Down
Loading