tailwind.config.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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<=160; 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': '#ffc82c',
  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-3': 'rgba(0, 0, 0, 0.03)',
  53. 'gray-4': 'rgba(0, 0, 0, 0.04)',
  54. 'gray-fafafa': '#fafafa',
  55. },
  56. fontSize: {
  57. '11': '11px',
  58. ...configFontSize,
  59. },
  60. extend: {
  61. lineHeight: {
  62. '0': '0px',
  63. ...configLineHeight,
  64. },
  65. spacing: configSpace,
  66. borderRadius: {
  67. DEFAULT: '8px',
  68. ...configBorderRadius,
  69. 'full': '9999px',
  70. }
  71. }
  72. }
  73. }