tailwind.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const path = require("path");
  2. const resolve = (p) => {
  3. return path.resolve(__dirname, p);
  4. };
  5. /** @type {import('tailwindcss').Config} */
  6. module.exports = {
  7. // 增加前辍避免样式冲突
  8. prefix: 'tw-',
  9. // 注意此处,一定要 `path.resolve` 一下, 传入绝对路径
  10. // 你要有其他目录,比如 components,也必须在这里,添加一下
  11. content: [
  12. "./index.html",
  13. "./pages/**/*.{html,js,ts,jsx,tsx,vue}",
  14. "./components/**/*.{html,js,ts,jsx,tsx,vue}",
  15. "./business/**/*.{html,js,ts,jsx,tsx,vue}",
  16. "./modules/**/*.{html,js,ts,jsx,tsx,vue}",
  17. ].map(resolve),
  18. corePlugins: {
  19. // 跨多端可以 h5 开启,小程序关闭
  20. preflight: false,
  21. },
  22. theme: {
  23. extend: {
  24. // 使用rpx作为单位
  25. spacing: {
  26. '30': '30rpx',
  27. '40': '40rpx',
  28. '50': '50rpx',
  29. }
  30. }
  31. },
  32. presets: [
  33. require('tailwindcss-rem2px-preset').createPreset({
  34. // 32 意味着 1rem = 32rpx
  35. fontSize: 4,
  36. // 转化的单位,可以变成 px / rpx
  37. unit: 'rpx'
  38. })
  39. ],
  40. };