2017-08-26 14:36:40 -05:00
|
|
|
import _ from 'lodash'
|
|
|
|
|
import postcss from 'postcss'
|
2017-10-06 15:40:40 -04:00
|
|
|
import escapeClassName from './escapeClassName'
|
2017-08-27 17:35:09 -04:00
|
|
|
|
2017-08-26 14:36:40 -05:00
|
|
|
export default function(className, properties) {
|
2017-08-25 23:29:55 -05:00
|
|
|
const decls = _.map(properties, (value, property) => {
|
2017-08-25 12:39:23 -04:00
|
|
|
return postcss.decl({
|
2017-08-26 23:50:02 -04:00
|
|
|
prop: `${property}`,
|
2017-08-26 23:34:04 -04:00
|
|
|
value: `${value}`,
|
2017-08-25 12:39:23 -04:00
|
|
|
})
|
2017-08-25 23:29:55 -05:00
|
|
|
})
|
2017-08-25 12:39:23 -04:00
|
|
|
|
2017-08-26 11:26:38 -04:00
|
|
|
return postcss.rule({
|
2017-10-06 15:40:40 -04:00
|
|
|
selector: `.${escapeClassName(className)}`,
|
2017-08-26 11:26:38 -04:00
|
|
|
}).append(decls)
|
2017-08-25 12:39:23 -04:00
|
|
|
}
|