pinceau icon indicating copy to clipboard operation
pinceau copied to clipboard

Question about CSS support in pseudo-elements

Open jiyuujin opened this issue 1 year ago • 5 comments

I'd like to hear about the behavior of css support in pseudo-elements. I think it don't work properly below.

Environment:

  • node.js 16.18.1
  • nuxt 3.2.0
  • pinceau 0.18.0
css({
  '.title': {
    'h3': {
      position: 'relative',
      '&::before': {
        content: '',
        position: 'absolute',
        top: '50%',
        left: 0,
        display: 'inline-block',
        width: '45px',
        height: '1px',
        backgroundColor: '#fff',
      },
    },
  },
})

Is there anything that seems strange to you?

jiyuujin avatar Mar 06 '23 08:03 jiyuujin

can you provide a minimum reproducible available repository

SGAMERyu avatar Mar 19 '23 15:03 SGAMERyu

Sample repository have been created, and please check it

jiyuujin avatar Mar 21 '23 10:03 jiyuujin

It should be that the content property is erased for the string, and I made a judgment call in this pr https://github.com/Tahul/pinceau/pull/77

.test::before {
   content: 
}

Therefore, the style does not take effect

SGAMERyu avatar Mar 23 '23 10:03 SGAMERyu

@jiyuujin I have noticed that the 'content' property in CSS can be manipulated using the "''" syntax. However, it does not handle errors well when dealing with quotation marks enclosed in double quotes.

SGAMERyu avatar Apr 10 '23 09:04 SGAMERyu

I'm bumping this as I should think of a better solution than #77 ;

For now I'm pretty sure you can workaround this issue using:

defineTheme({
   utils: {
      content: (value) => value ? value : `\'\'`
   }
})

Utils properties can also be used to overwrite native css properties behavior :)

Tahul avatar Sep 12 '23 18:09 Tahul