Skip to content

Commit 9b18ea8

Browse files
committed
chore: add custom-property config option alias
1 parent 3e05087 commit 9b18ea8

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/clean-wolves-occur.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'phosphor-icons-tailwindcss': patch
3+
---
4+
5+
allow passing `custom-property` option (alias to `customProperty`) to better match CSS naming
6+
convention (helpful to avoid auto-format when used with Tailwind 4 `@plugin` syntax)

src/plugin.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export interface Options {
1212
* CSS custom property for icon URL.
1313
* Default to `--ph-url`
1414
*/
15+
'custom-property': string;
16+
/** alias for 'custom-property' option */
1517
customProperty: string;
1618
}
1719

src/plugin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ const ICON_SET = /** @type {Set<string>} */ (new Set(icons.map((i) => i.name)));
88

99
export default createPlugin.withOptions(
1010
/** @param {Partial<import('./plugin').Options>} options */
11-
function (options) {
12-
const { prefix = 'ph', customProperty = '--ph-url' } = options ?? {};
11+
function (options = {}) {
12+
const prefix = options.prefix ?? 'ph';
13+
const customProperty = options['custom-property'] ?? options['customProperty'] ?? '--ph-url';
1314

1415
return function (api) {
1516
api.addComponents({

0 commit comments

Comments
 (0)