Skip to content

Commit

Permalink
Always use function for determining prefixes internally
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Jan 30, 2018
1 parent ffabb9f commit d9bc4e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/util/applyClassPrefix.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export default function(css, prefix) {
const prefixIsFunc = typeof prefix === 'function'
const getPrefix = typeof prefix === 'function' ? prefix : () => prefix

css.walkRules(rule => {
rule.selectors = rule.selectors.map(
selector => `.${prefixIsFunc ? prefix(selector) : prefix}${selector.slice(1)}`
)
rule.selectors = rule.selectors.map(selector => `.${getPrefix(selector)}${selector.slice(1)}`)
})
return css
}

0 comments on commit d9bc4e6

Please sign in to comment.