1
0

uno.config.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // uno.config.ts
  2. import {
  3. defineConfig,
  4. presetAttributify,
  5. presetIcons,
  6. presetTypography,
  7. presetUno,
  8. presetWebFonts,
  9. transformerDirectives,
  10. transformerVariantGroup,
  11. } from 'unocss'
  12. export default defineConfig({
  13. shortcuts: [],
  14. rules: [],
  15. variants: [
  16. // 使用工具函数
  17. matcher => {
  18. if (!matcher.endsWith('!'))
  19. return matcher
  20. return {
  21. matcher: matcher.slice(0, -1),
  22. selector: s => `${s}!important`,
  23. }
  24. },
  25. ],
  26. theme: {
  27. colors: {
  28. // ...
  29. },
  30. },
  31. presets: [
  32. presetUno(),
  33. presetAttributify(),
  34. presetIcons({
  35. collections: {
  36. tabler: () => import('@iconify-json/tabler/icons.json').then(i => i.default),
  37. },
  38. extraProperties: {
  39. 'display': 'inline-block',
  40. 'height': '1.2em',
  41. 'width': '1.2em',
  42. 'vertical-align': 'text-bottom',
  43. },
  44. }),
  45. presetTypography(),
  46. presetWebFonts(),
  47. ],
  48. transformers: [
  49. transformerDirectives(),
  50. transformerVariantGroup(),
  51. ],
  52. content: {
  53. pipeline: {
  54. include: [
  55. // default
  56. /\.(vue|[jt]sx|ts)($|\?)/,
  57. // 参考:https://unocss.dev/guide/extracting#extracting-from-build-tools-pipeline
  58. ],
  59. // exclude files
  60. // exclude: []
  61. },
  62. },
  63. })