uno.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import {defineConfig, presetUno, presetIcons, presetAttributify} from 'unocss'
  2. import {presetExtra} from 'unocss-preset-extra';
  3. import presetWeapp from 'unocss-preset-weapp'
  4. import {transformerAttributify, transformerClass} from 'unocss-preset-weapp/transformer'
  5. export default defineConfig({
  6. shortcuts: {
  7. 'hc-flex': 'relative flex items-center',
  8. 'hc-flex-center': 'hc-flex justify-center',
  9. 'hc-flex-end': 'hc-flex justify-end',
  10. 'hc-p': 'px-3 py-2',
  11. 'hc-tr': 'absolute top-0 right-0',
  12. },
  13. presets: [
  14. presetUno(),
  15. presetWeapp(),
  16. presetIcons({
  17. //autoInstall: true, //自动安装图标库
  18. }),
  19. presetAttributify({
  20. prefix: 'un-', //属性冲突的自定义前缀
  21. prefixedOnly: true, //强制使用前缀
  22. }),
  23. //其它扩展,主要用动画,集成了 animate.css
  24. presetExtra(),
  25. ],
  26. transformers: [
  27. transformerAttributify(),
  28. transformerClass(),
  29. ]
  30. })