Skip to content

Commit 521f87f

Browse files
committedFeb 4, 2024
feat(preset-icons): support collectionsNodeResolvePath option
1 parent 2101fbc commit 521f87f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎packages/preset-icons/src/core.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function createPresetIcons(lookupIconLoader: (options: IconsOptions) => P
2626
extraProperties = {},
2727
customizations = {},
2828
autoInstall = false,
29+
collectionsNodeResolvePath,
2930
layer = 'icons',
3031
unit,
3132
} = options
@@ -37,6 +38,7 @@ export function createPresetIcons(lookupIconLoader: (options: IconsOptions) => P
3738
scale,
3839
customCollections,
3940
autoInstall,
41+
cwd: collectionsNodeResolvePath,
4042
// avoid warn from @iconify/loader: we'll warn below if not found
4143
warn: undefined,
4244
customizations: {

‎packages/preset-icons/src/types.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,23 @@ export interface IconsOptions {
5656
/**
5757
* Auto install icon sources package when the usages is detected
5858
*
59-
* **WARNING**: only on `node` environment, on `browser` this option will be ignored.
59+
* Only effective in Node.js environment.
6060
*
6161
* @default false
6262
*/
6363
autoInstall?: boolean
64+
/**
65+
* Path to resolve the iconify collections in Node.js environment.
66+
*
67+
* @default process.cwd()
68+
*/
69+
collectionsNodeResolvePath?: string
6470
/**
6571
* Custom icon unit.
6672
*
6773
* @default `em`
6874
*/
6975
unit?: string
70-
7176
/**
7277
* Load icons from CDN. Should starts with `https://` and ends with `/`
7378
*
@@ -76,7 +81,6 @@ export interface IconsOptions {
7681
* - https://cdn.skypack.dev/
7782
*/
7883
cdn?: string
79-
8084
/**
8185
* Custom fetch function to provide the icon data.
8286
*/

0 commit comments

Comments
 (0)
Please sign in to comment.