1
0

uno.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // Use utility functions
  58. // Reference: https://unocss.dev/guide/extracting#extracting-from-build-tools-pipeline
  59. ],
  60. // exclude files
  61. // exclude: []
  62. },
  63. },
  64. })