tailwind.config.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import type { Config } from "tailwindcss";
  2. const plugin = require("tailwindcss/plugin");
  3. const MAX_WIDTH = 1440;
  4. const toRem = (px: number) => {
  5. return `${((4 * px) / (MAX_WIDTH / 10)).toFixed(2)}rem`;
  6. };
  7. const keyframes = {
  8. "slow-bounce": {
  9. "0%,100%": {
  10. transform: "translateY(-10px)",
  11. animationTimingFunction: "cubic-bezier(0.8, 0, 1, 1)",
  12. },
  13. "50%": {
  14. transform: "none",
  15. animationTimingFunction: "cubic-bezier(0, 0, 0.2, 1)",
  16. },
  17. },
  18. shake: {
  19. "10%,90% ": {
  20. transform: "translate3d(-1px, 0, 0) rotate(-1deg)",
  21. },
  22. "20%,80%": {
  23. transform: "translate3d(2px, 0, 0) rotate(1deg)",
  24. },
  25. "30%,70%": {
  26. transform: "translate3d(-3px, 0, 0) rotate(-3deg)",
  27. },
  28. "40%,60%": {
  29. transform: "translate3d(3px, 0, 0) rotate(1deg)",
  30. },
  31. "50%": {
  32. transform: "translate3d(-3px, 0, 0) rotate(3deg)",
  33. },
  34. },
  35. };
  36. const size: any = Array.from({ length: 100 }).reduce((map: any, _, index) => {
  37. map[index] = toRem(index);
  38. return map;
  39. }, {});
  40. // 0.0694rem
  41. const config: Config = {
  42. content: [
  43. "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
  44. "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
  45. "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  46. ],
  47. theme: {
  48. // space: size,
  49. // padding: size,
  50. // height: size,
  51. // minWidth: size,
  52. // lineHeight: size,
  53. // width: size,
  54. // gap: size,
  55. // minHeight: size,
  56. // fontSize: size,
  57. extend: {
  58. backgroundImage: {
  59. "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
  60. "gradient-conic":
  61. "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
  62. },
  63. padding: {
  64. "spacing-x": "0.12rem",
  65. "spacing-y": "0.08rem",
  66. },
  67. textShadow: {},
  68. keyframes: keyframes,
  69. animation: {
  70. "slow-bounce": "slow-bounce 1s linear infinite",
  71. "slow-shake": "shake 0.8s ease-in-out infinite",
  72. },
  73. },
  74. colors: {
  75. "primary-color": "var(--primary-color)",
  76. "bg-color": "var(--bg-color)",
  77. "bg-block-color": "var(--bg-block-color)",
  78. "bg-block-foreground-color": "var(--block-foreground-color)",
  79. "linear-color": "linear-gradient(180deg, #ffaa30, #ffe6be)",
  80. },
  81. },
  82. plugins: [
  83. plugin(function ({ addUtilities }: any) {
  84. addUtilities({
  85. "text-stroke": {
  86. webkitTextStroke: "1px #fff",
  87. },
  88. });
  89. }),
  90. ],
  91. };
  92. export default config;