tailwind.config.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /** @type {import('tailwindcss').Config} */
  2. let configFontSize = {}
  3. let configLineHeight = {}
  4. for(let i=10;i<=64; i+=2){
  5. configFontSize[i] = [`${i}px`, `${i}px`]
  6. configLineHeight[i] = `${i}px`
  7. }
  8. let configSpace = {}
  9. for(let i=2;i<=200; i+=2){
  10. configSpace[i] = `${i}px`
  11. }
  12. let configBorderRadius = {}
  13. for(let i=2;i<=50; i+=2){
  14. configBorderRadius[i] = `${i}px`
  15. }
  16. module.exports = {
  17. // 这里给出了一份 taro 通用示例,具体要根据你自己项目的目录结构进行配置
  18. // 比如你使用 vue3 项目,你就需要把 vue 这个格式也包括进来
  19. // 不在 content glob表达式中包括的文件,在里面编写tailwindcss class,是不会生成对应的css工具类的
  20. content: ['./public/index.html', './src/**/*.{html,js,ts,jsx,tsx}'],
  21. // 其他配置项 ...
  22. corePlugins: {
  23. // 小程序不需要 preflight,因为这主要是给 h5 的,如果你要同时开发多端,你应该使用 process.env.TARO_ENV 环境变量来控制它
  24. preflight: false,
  25. },
  26. theme: {
  27. colors: {
  28. 'white': '#FFFFFF',
  29. 'primary': '#317CFA',
  30. 'primary-10': 'rgba(49, 124, 250, 0.1)',
  31. 'black': '#000000',
  32. 'black-3': '#333333',
  33. 'black-6': '#666666',
  34. 'black-9': '#999999',
  35. 'harsh': '#F94F17',
  36. 'purple': '#7e5bef',
  37. 'pink': '#ff49db',
  38. 'orange': '#FD561F',
  39. 'red': '#EE4949',
  40. 'green': '#31BE59',
  41. 'yellow': '#EE9E49',
  42. 'gray': '#f6f6f6',
  43. 'gray-page': '#f6f6f6',
  44. 'gray-dark': '#273444',
  45. 'gray-f8': '#F8F8F8',
  46. 'black-light': 'rgba(0, 0, 0, 0.45)',
  47. 'gray-25': 'rgba(0, 0, 0, 0.25)',
  48. 'gray-45': 'rgba(0, 0, 0, 0.45)',
  49. 'gray-65': 'rgba(0, 0, 0, 0.65)',
  50. 'gray-sub': 'rgba(0, 0, 0, 0.75)',
  51. 'gray-light': 'rgba(0, 0, 0, 0.08)',
  52. 'gray-2': 'rgba(0, 0, 0, 0.02)',
  53. 'gray-3': 'rgba(0, 0, 0, 0.03)',
  54. 'gray-4': 'rgba(0, 0, 0, 0.04)',
  55. 'gray-fafafa': '#fafafa',
  56. },
  57. fontSize: {
  58. '11': '11px',
  59. ...configFontSize,
  60. },
  61. extend: {
  62. lineHeight: {
  63. '0': '0px',
  64. ...configLineHeight,
  65. },
  66. spacing: configSpace,
  67. borderRadius: {
  68. DEFAULT: '8px',
  69. ...configBorderRadius,
  70. 'full': '9999px',
  71. }
  72. }
  73. }
  74. }