threepointone/glamor

what if i don't need hash name?

Closed this issue · 1 comments

is there any way, i can do like this

import { css } from 'glamor'

// make css rules
let rule = css({
  customname: '.mod-button', // something manage by hand
  color: 'red',
  ':hover': {
    color: 'pink'
  },
  '@media(min-width: 300px)': {
    color: 'green',
    ':hover': {
      color: 'yellow'
    }
  }
})

// add as data attributes
<div {...rule} {...another}>
  zomg
</div>

render result:

.mod-button{
  color: red;
  ...
}
<div class="mod-button">zomg</div>

sometimes, we can manage classname by hand much better, no need hash name!

we do love the css in js style.

You could insert a global rule instead, though you'll lose all the benefits of scoping and stuff. Your call.