Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line-clamp 这个貌似在小程序中没有转换...而且不会高亮显示。 #78

Closed
djkloop opened this issue Jun 25, 2023 · 2 comments

Comments

@djkloop
Copy link

djkloop commented Jun 25, 2023

image

    "unocss": "^0.53.3",
    "unocss-preset-weapp": "^0.53.2",
    "@unocss/preset-icons": "^0.53.3",

unocss.config.js

/**
 * unocss defineConfig
 * @link unocss: https://github.com/unocss/unocss
 * @link unocss-preset-weapp: https://github.com/MellowCo/unocss-preset-weapp
 * */

import { defineConfig, presetIcons } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'
import { transformerAttributify, transformerClass } from 'unocss-preset-weapp/transformer'

const transformRules = {
  '.': '-d111-',
  '/': '-s111-',
  ':': '-c111-',
  '%': '-p111-',
  '!': '-e111-',
  '#': '-w111-',
  '(': '-b111l-',
  ')': '-b111r-',
  '[': '-f111l-',
  ']': '-f111r-',
  $: '-r111-',
  ',': '-r222-',
}

const prefix = `_u_`

export default defineConfig({
  presets: [
    // https://github.com/MellowCo/unocss-preset-weapp
    presetWeapp({
      nonValuedAttribute: true,
      prefix: prefix,
      whRpx: true,
      transform: true,
      platform: 'uniapp',
      transformRules,
    }),
    presetIcons({
      scale: 1.2,
      warn: true,
    }),
  ],
  shortcuts: [
    {
      'border-base': 'border border-gray-500_10',
      '_u_z-tar-both': '_u_z-988',
      '_u_head-fixed': '_u_fixed _u_top-0 _u_left-0 _u_w-full _u_z-tar-both',
      _u_center: '_u_flex _u_justify-center _u_items-center',
    },
  ],
  theme: {},
  transformers: [
    transformerAttributify({
      classPrefix: prefix,
      transformRules,
      nonValuedAttribute: true,
    }),
    transformerClass({
      transformRules,
    }),
  ],
})

在unocss playground确实支持line-clamp 地址↓

demo linkDEMO LINK

@MellowCo
Copy link
Owner

加上了,升级到 0.53.3

@djkloop
Copy link
Author

djkloop commented Jun 25, 2023

@MellowCo 感谢,高效率

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants