Skip to content

Commit

Permalink
feat(preset-icons): support collectionsNodeResolvePath option
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 4, 2024
1 parent 2101fbc commit 521f87f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/preset-icons/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function createPresetIcons(lookupIconLoader: (options: IconsOptions) => P
extraProperties = {},
customizations = {},
autoInstall = false,
collectionsNodeResolvePath,
layer = 'icons',
unit,
} = options
Expand All @@ -37,6 +38,7 @@ export function createPresetIcons(lookupIconLoader: (options: IconsOptions) => P
scale,
customCollections,
autoInstall,
cwd: collectionsNodeResolvePath,
// avoid warn from @iconify/loader: we'll warn below if not found
warn: undefined,
customizations: {
Expand Down
10 changes: 7 additions & 3 deletions packages/preset-icons/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@ export interface IconsOptions {
/**
* Auto install icon sources package when the usages is detected
*
* **WARNING**: only on `node` environment, on `browser` this option will be ignored.
* Only effective in Node.js environment.
*
* @default false
*/
autoInstall?: boolean
/**
* Path to resolve the iconify collections in Node.js environment.
*
* @default process.cwd()
*/
collectionsNodeResolvePath?: string
/**
* Custom icon unit.
*
* @default `em`
*/
unit?: string

/**
* Load icons from CDN. Should starts with `https://` and ends with `/`
*
Expand All @@ -76,7 +81,6 @@ export interface IconsOptions {
* - https://cdn.skypack.dev/
*/
cdn?: string

/**
* Custom fetch function to provide the icon data.
*/
Expand Down

0 comments on commit 521f87f

Please sign in to comment.