Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit c3d7158

Browse files
committed
Code cleanup
1 parent ebdc70f commit c3d7158

File tree

3 files changed

+147
-48
lines changed

3 files changed

+147
-48
lines changed

index.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const _ = require('lodash');
22
const Color = require('color');
33

44
module.exports = function() {
5-
return ({ config, e, addUtilities, variants }) => {
6-
const defaultDirections = {
5+
return ({ theme, variants, e, addUtilities }) => {
6+
const defaultGradientDirections = {
77
't': 'to top',
88
'tr': 'to top right',
99
'r': 'to right',
@@ -13,18 +13,22 @@ module.exports = function() {
1313
'l': 'to left',
1414
'tl': 'to top left',
1515
};
16-
const defaultColors = {};
17-
const defaultVariants = ['responsive'];
16+
const defaultGradientColors = {};
17+
const defaultGradientVariants = ['responsive'];
18+
19+
const gradientDirections = theme('gradients.directions', defaultGradientDirections);
20+
const gradientColors = theme('gradients.colors', defaultGradientColors);
21+
const gradientVariants = variants('gradients', defaultGradientVariants);
1822

1923
const gradientUtilities = (function() {
2024
let utilities = {};
21-
_.forEach(config('theme.gradients.colors', defaultColors), (colors, colorKey) => {
25+
_.forEach(gradientColors, (colors, colorKey) => {
2226
if (!_.isArray(colors) || colors.length === 1) {
2327
let color = _.isArray(colors) ? colors[0] : colors;
2428
let parsedColor = Color(color);
2529
colors = [parsedColor.alpha(0).rgb().string(), color];
2630
}
27-
_.forEach(config('theme.gradients.directions', defaultDirections), (direction, directionKey) => {
31+
_.forEach(gradientDirections, (direction, directionKey) => {
2832
utilities[`.${e(`bg-gradient-${directionKey}-${colorKey}`)}`] = {
2933
backgroundImage: `linear-gradient(${direction}, ${colors.join(', ')})`,
3034
};
@@ -33,6 +37,6 @@ module.exports = function() {
3337
return utilities;
3438
})();
3539

36-
addUtilities(gradientUtilities, variants('gradients', defaultVariants));
40+
addUtilities(gradientUtilities, gradientVariants);
3741
};
3842
};

package-lock.json

+134-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"jest": "^24.8.0",
2424
"jest-matcher-css": "^1.0.3",
2525
"postcss": "^7.0.16",
26-
"release-it": "^11.0.4",
27-
"tailwindcss": "^1.0.0"
26+
"release-it": "^12.2.0",
27+
"tailwindcss": "^1.0.1"
2828
}
2929
}

0 commit comments

Comments
 (0)