You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tailwind.config.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {readFileSync} from 'node:fs';
  2. import {env} from 'node:process';
  3. import {parse} from 'css-variables-parser';
  4. const isProduction = env.NODE_ENV !== 'development';
  5. export default {
  6. prefix: 'tw-',
  7. content: [
  8. isProduction && '!./templates/devtest/**/*',
  9. isProduction && '!./web_src/js/standalone/devtest.js',
  10. './templates/**/*.tmpl',
  11. './web_src/**/*.{js,vue}',
  12. ].filter(Boolean),
  13. blocklist: [
  14. // classes that don't work without CSS variables from "@tailwind base" which we don't use
  15. 'transform', 'shadow', 'ring', 'blur', 'grayscale', 'invert', '!invert', 'filter', '!filter',
  16. 'backdrop-filter',
  17. // unneeded classes
  18. '[-a-zA-Z:0-9_.]',
  19. ],
  20. theme: {
  21. colors: {
  22. // make `tw-bg-red` etc work with our CSS variables
  23. ...Object.fromEntries(
  24. Object.keys(parse([
  25. readFileSync(new URL('web_src/css/themes/theme-gitea-light.css', import.meta.url), 'utf8'),
  26. readFileSync(new URL('web_src/css/themes/theme-gitea-dark.css', import.meta.url), 'utf8'),
  27. ].join('\n'), {})).filter((prop) => prop.startsWith('color-')).map((prop) => {
  28. const color = prop.substring(6);
  29. return [color, `var(--color-${color})`];
  30. })
  31. ),
  32. inherit: 'inherit',
  33. current: 'currentcolor',
  34. transparent: 'transparent',
  35. },
  36. },
  37. };