Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

tailwind.config.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import {readFileSync} from 'node:fs';
  2. import {env} from 'node:process';
  3. import {parse} from 'postcss';
  4. const isProduction = env.NODE_ENV !== 'development';
  5. function extractRootVars(css) {
  6. const root = parse(css);
  7. const vars = new Set();
  8. root.walkRules((rule) => {
  9. if (rule.selector !== ':root') return;
  10. rule.each((decl) => {
  11. if (decl.value && decl.prop.startsWith('--')) {
  12. vars.add(decl.prop.substring(2));
  13. }
  14. });
  15. });
  16. return Array.from(vars);
  17. }
  18. const vars = extractRootVars([
  19. readFileSync(new URL('web_src/css/themes/theme-gitea-light.css', import.meta.url), 'utf8'),
  20. readFileSync(new URL('web_src/css/themes/theme-gitea-dark.css', import.meta.url), 'utf8'),
  21. ].join('\n'));
  22. export default {
  23. prefix: 'tw-',
  24. important: true, // the frameworks are mixed together, so tailwind needs to override other framework's styles
  25. content: [
  26. isProduction && '!./templates/devtest/**/*',
  27. isProduction && '!./web_src/js/standalone/devtest.js',
  28. '!./templates/swagger/v1_json.tmpl',
  29. '!./templates/user/auth/oidc_wellknown.tmpl',
  30. '!**/*_test.go',
  31. '!./modules/{public,options,templates}/bindata.go',
  32. './{build,models,modules,routers,services}/**/*.go',
  33. './templates/**/*.tmpl',
  34. './web_src/js/**/*.{js,vue}',
  35. ].filter(Boolean),
  36. blocklist: [
  37. // classes that don't work without CSS variables from "@tailwind base" which we don't use
  38. 'transform', 'shadow', 'ring', 'blur', 'grayscale', 'invert', '!invert', 'filter', '!filter',
  39. 'backdrop-filter',
  40. // unneeded classes
  41. '[-a-zA-Z:0-9_.]',
  42. ],
  43. theme: {
  44. colors: {
  45. // make `tw-bg-red` etc work with our CSS variables
  46. ...Object.fromEntries(vars.filter((prop) => prop.startsWith('color-')).map((prop) => {
  47. const color = prop.substring(6);
  48. return [color, `var(--color-${color})`];
  49. })),
  50. inherit: 'inherit',
  51. current: 'currentcolor',
  52. transparent: 'transparent',
  53. },
  54. borderRadius: {
  55. 'none': '0',
  56. 'sm': '2px',
  57. 'DEFAULT': 'var(--border-radius)', // 4px
  58. 'md': 'var(--border-radius-medium)', // 6px
  59. 'lg': '8px',
  60. 'xl': '12px',
  61. '2xl': '16px',
  62. '3xl': '24px',
  63. 'full': 'var(--border-radius-circle)', // 50%
  64. },
  65. },
  66. };