Skip to content

Commit 7575fe1

Browse files
author
Gary Tokman
committed
fix: updates to where the assets live
1 parent 223c5a2 commit 7575fe1

File tree

7 files changed

+42
-61
lines changed

7 files changed

+42
-61
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
Install the plugin from npm:
88

99
```sh
10-
$ npm install tailwind-corner-smoothing
10+
npm install tailwind-corner-smoothing --save-dev
11+
12+
mkdir -p ./masks && cp -r ./node_modules/corner-smoothing/masks/* ./masks/
1113
```
1214

1315
# Usage

index.js

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,39 @@
1-
const plugin = require('tailwindcss/plugin');
2-
3-
module.exports = plugin(
4-
function (_a) {
5-
const { addUtilities } = _a;
6-
const { theme } = _a;
7-
const options = theme('cornerSmoothing') || {};
8-
const sizes = options.sizes || {
9-
sm: '25px',
10-
md: '60px',
11-
lg: '75px',
1+
var plugin = require('tailwindcss/plugin');
2+
module.exports = plugin(function (_a) {
3+
var addUtilities = _a.addUtilities, theme = _a.theme;
4+
var options = theme('cornerSmoothing') || {};
5+
var sizes = options.sizes || {
6+
sm: '25px',
7+
md: '60px',
8+
lg: '75px',
129
};
13-
const utilities = {};
10+
var utilities = {};
1411
Object.entries(sizes).forEach(function (_a) {
15-
const key = _a[0];
16-
const size = _a[1];
17-
utilities['.smooth-corners-'.concat(key)] = {
18-
'@supports (mask-border-width: 50px)': {
19-
'mask-border': 'url("'
20-
.concat(
21-
options.maskPath || './assets/masks/[email protected]',
22-
'") 49% fill / '
23-
)
24-
.concat(size),
25-
'@media (min-resolution: 2x)': {
26-
'mask-border': 'url("'
27-
.concat(
28-
options.maskPath2x || './assets/masks/[email protected]',
29-
'") 49% fill / '
30-
)
31-
.concat(size),
32-
},
33-
'@media (min-resolution: 3x)': {
34-
'mask-border': 'url("'
35-
.concat(
36-
options.maskPath3x || './assets/masks/[email protected]',
37-
'") 49% fill / '
38-
)
39-
.concat(size),
40-
},
41-
},
42-
};
12+
var key = _a[0], size = _a[1];
13+
utilities[".smooth-corners-".concat(key)] = {
14+
'@supports (mask-border-width: 50px)': {
15+
'mask-border': "url(\"".concat(options.maskPath || './assets/masks/[email protected]', "\") 49% fill / ").concat(size),
16+
'@media (min-resolution: 2x)': {
17+
'mask-border': "url(\"".concat(options.maskPath2x || './assets/masks/[email protected]', "\") 49% fill / ").concat(size),
18+
},
19+
'@media (min-resolution: 3x)': {
20+
'mask-border': "url(\"".concat(options.maskPath3x || './assets/masks/[email protected]', "\") 49% fill / ").concat(size),
21+
},
22+
},
23+
};
4324
});
4425
addUtilities(utilities);
45-
},
46-
{
26+
}, {
4727
theme: {
48-
cornerSmoothing: {
49-
maskPath: './assets/masks/[email protected]',
50-
maskPath2x: './assets/masks/[email protected]',
51-
maskPath3x: './assets/masks/[email protected]',
52-
sizes: {
53-
sm: '25px',
54-
md: '60px',
55-
lg: '75px',
28+
cornerSmoothing: {
29+
maskPath: './assets/masks/[email protected]',
30+
maskPath2x: './assets/masks/[email protected]',
31+
maskPath3x: './assets/masks/[email protected]',
32+
sizes: {
33+
sm: '25px',
34+
md: '60px',
35+
lg: '75px',
36+
},
5637
},
57-
},
5838
},
59-
}
60-
);
39+
});

index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ module.exports = plugin(
1515
utilities[`.smooth-corners-${key}`] = {
1616
'@supports (mask-border-width: 50px)': {
1717
'mask-border': `url("${
18-
options.maskPath || './assets/masks/[email protected]'
18+
options.maskPath || '/masks/[email protected]'
1919
}") 49% fill / ${size}`,
2020
'@media (min-resolution: 2x)': {
2121
'mask-border': `url("${
22-
options.maskPath2x || './assets/masks/[email protected]'
22+
options.maskPath2x || '/masks/[email protected]'
2323
}") 49% fill / ${size}`,
2424
},
2525
'@media (min-resolution: 3x)': {
2626
'mask-border': `url("${
27-
options.maskPath3x || './assets/masks/[email protected]'
27+
options.maskPath3x || '/masks/[email protected]'
2828
}") 49% fill / ${size}`,
2929
},
3030
},
@@ -36,9 +36,9 @@ module.exports = plugin(
3636
{
3737
theme: {
3838
cornerSmoothing: {
39-
maskPath: './assets/masks/[email protected]',
40-
maskPath2x: './assets/masks/[email protected]',
41-
maskPath3x: './assets/masks/[email protected]',
39+
maskPath: '/masks/[email protected]',
40+
maskPath2x: '/masks/[email protected]',
41+
maskPath3x: '/masks/[email protected]',
4242
sizes: {
4343
sm: '25px',
4444
md: '60px',
File renamed without changes.
File renamed without changes.
File renamed without changes.

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ describe('Smooth Corners Plugin', () => {
1919
utilities['.smooth-corners-md']['@supports (mask-border-width: 50px)'][
2020
'mask-border'
2121
]
22-
).toBe('url("./assets/masks/[email protected]") 49% fill / 60px');
22+
).toBe('url("/masks/[email protected]") 49% fill / 60px');
2323
});
2424
});

0 commit comments

Comments
 (0)