tailwind.config.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-45': 'rgba(0, 0, 0, 0.45)',
  48. 'gray-65': 'rgba(0, 0, 0, 0.65)',
  49. 'gray-sub': 'rgba(0, 0, 0, 0.75)',
  50. 'gray-light': 'rgba(0, 0, 0, 0.08)',
  51. 'gray-3': 'rgba(0, 0, 0, 0.03)',
  52. 'gray-4': 'rgba(0, 0, 0, 0.04)',
  53. 'gray-fafafa': '#fafafa',
  54. },
  55. fontSize: {
  56. '11': '11px',
  57. ...configFontSize,
  58. },
  59. extend: {
  60. lineHeight: {
  61. '0': '0px',
  62. ...configLineHeight,
  63. },
  64. spacing: configSpace,
  65. borderRadius: {
  66. DEFAULT: '8px',
  67. ...configBorderRadius,
  68. 'full': '9999px',
  69. }
  70. }
  71. }
  72. }