Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit bc2d79f

Browse files
committed
Support returning object, update opacity plugin
1 parent d379770 commit bc2d79f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/corePlugins/opacity.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
const nameClass = require('tailwindcss/lib/util/nameClass').default
22
const { asValue } = require('../pluginUtils')
3+
const { newFormat } = require('../pluginUtils')
34

45
module.exports = function ({ jit: { theme, addUtilities, addVariant, e } }) {
56
addUtilities({
6-
opacity: (modifier, { theme }) => {
7+
opacity: newFormat((modifier, { theme }) => {
78
let value = asValue(modifier, theme.opacity)
89

910
if (value === undefined) {
1011
return []
1112
}
1213

13-
return [[nameClass('opacity', modifier), { opacity: value }]]
14-
},
14+
return { [nameClass('opacity', modifier)]: { opacity: value } }
15+
}),
1516
})
1617
}

src/lib/generateRules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function generateRules(tailwindConfig, candidates, context) {
132132

133133
for (let [sort, plugin] of plugins) {
134134
if (typeof plugin === 'function') {
135-
for (let ruleSet of plugin(modifier, pluginHelpers)) {
135+
for (let ruleSet of [].concat(plugin(modifier, pluginHelpers))) {
136136
if (plugin.format !== 'new') {
137137
let options = {}
138138
if (Array.isArray(ruleSet)) {

0 commit comments

Comments
 (0)