tailwindcss/src/util/define-class.js
2017-08-27 18:02:41 -04:00

17 lines
381 B
JavaScript

const _ = require('lodash')
const postcss = require('postcss')
module.exports = function defineClass(className, properties) {
const decls = _.map(properties, (value, property) => {
return postcss.decl({
prop: _.kebabCase(property),
value: value,
})
})
return postcss
.rule({
selector: `.${_.kebabCase(className)}`,
})
.append(decls)
}