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

Commit f62cc7f

Browse files
committed
fix escaping
1 parent a256802 commit f62cc7f

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

index.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ const _ = require('lodash');
33
module.exports = ({
44
variants = {},
55
gradients = {},
6-
} = {}) =>
7-
({ e, addUtilities }) => {
8-
addUtilities(
9-
{
10-
...Object.assign(
11-
{},
12-
..._.map(gradients, (colors, name) => {
13-
if (!_.isArray(colors)) {
14-
colors = ['transparent', colors];
15-
}
16-
return {
17-
[`.bg-gradient-to-top-${e(name)}`]: { backgroundImage: `linear-gradient(to top, ${colors.join(', ')})` },
18-
[`.bg-gradient-to-right-${e(name)}`]: { backgroundImage: `linear-gradient(to right, ${colors.join(', ')})` },
19-
[`.bg-gradient-to-bottom-${e(name)}`]: { backgroundImage: `linear-gradient(to bottom, ${colors.join(', ')})` },
20-
[`.bg-gradient-to-left-${e(name)}`]: { backgroundImage: `linear-gradient(to left, ${colors.join(', ')})` },
21-
};
22-
}),
23-
),
24-
},
25-
variants,
26-
);
27-
};
6+
} = {}) => ({ e, addUtilities }) => {
7+
addUtilities(
8+
{
9+
...Object.assign(
10+
{},
11+
..._.map(gradients, (colors, name) => {
12+
if (!_.isArray(colors)) {
13+
colors = ['transparent', colors];
14+
}
15+
return {
16+
[`.${e(`bg-gradient-to-top-${name}`)}`]: { backgroundImage: `linear-gradient(to top, ${colors.join(', ')})` },
17+
[`.${e(`bg-gradient-to-right-${name}`)}`]: { backgroundImage: `linear-gradient(to right, ${colors.join(', ')})` },
18+
[`.${e(`bg-gradient-to-bottom-${name}`)}`]: { backgroundImage: `linear-gradient(to bottom, ${colors.join(', ')})` },
19+
[`.${e(`bg-gradient-to-left-${name}`)}`]: { backgroundImage: `linear-gradient(to left, ${colors.join(', ')})` },
20+
};
21+
}),
22+
),
23+
},
24+
variants,
25+
);
26+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailwindcss-gradients",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Tailwind CSS plugin to generate gradient background utilities",
55
"author": "Benoît Rouleau <[email protected]>",
66
"license": "ISC",

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ plugin({
1010
},
1111
})({
1212
e: value => value,
13-
addUtilities: (utilities, variants) => {
13+
addUtilities: (utilities) => {
1414
generatedUtilities = utilities;
1515
},
1616
});
1717

18-
console.log("generatedUtilities", generatedUtilities);
18+
console.log('generatedUtilities', generatedUtilities);

0 commit comments

Comments
 (0)