Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ module.exports = {
modules: {
appearance: ['responsive'],
backgroundColors: ['responsive', 'hover'],
backgroundGradients: ['responsive'],
backgroundPosition: ['responsive'],
backgroundSize: ['responsive'],
borderColors: ['responsive', 'hover'],
Expand Down
23 changes: 23 additions & 0 deletions src/generators/backgroundGradients.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import _ from 'lodash'
import defineClasses from '../util/defineClasses'

export default function({ backgroundColors }) {
return _.compact(
_.flatMap(backgroundColors, (startColor, startClassName) => {
return _.flatMap(backgroundColors, (endColor, endClassName) => {
if (startClassName === endClassName) {
return false
}

return defineClasses({
[`bg-gradient-y-${startClassName}-to-${endClassName}`]: {
'background-color': `linear-gradient(${startColor}, ${endColor})`,
},
[`bg-gradient-x-${startClassName}-to-${endClassName}`]: {
'background-color': `linear-gradient(to right, ${startColor}, ${endColor})`,
},
})
})
})
)
}
2 changes: 2 additions & 0 deletions src/utilityModules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import lists from './generators/lists'
import appearance from './generators/appearance'
import backgroundColors from './generators/backgroundColors'
import backgroundGradients from './generators/backgroundGradients'
import backgroundPosition from './generators/backgroundPosition'
import backgroundSize from './generators/backgroundSize'
import borderColors from './generators/borderColors'
Expand Down Expand Up @@ -44,6 +45,7 @@ export default [
{ name: 'lists', generator: lists },
{ name: 'appearance', generator: appearance },
{ name: 'backgroundColors', generator: backgroundColors },
{ name: 'backgroundGradients', generator: backgroundGradients },
{ name: 'backgroundPosition', generator: backgroundPosition },
{ name: 'backgroundSize', generator: backgroundSize },
{ name: 'borderColors', generator: borderColors },
Expand Down