directory
title: Exporting Icons as SVG
types:
SVG: '../svg/index.md'
IconSet: '../icon-set/index.md'
IconifyJSON: '/docs/types/iconify-json.md'
functions:
export: '../icon-set/export.md'
Exporting icons to directory
This tutorial is part of export functions documentation in Iconify Tools.
Function [func]exportToDirectory() writes all icons in [type]IconSet instance to a specified directory.
Usage
Function has the following parameters:
[prop]iconSet,[type]IconSet. Icon set to export.[prop]options,[type]object. Options. See below.
Function returns array of stored icons.
Function is asynchronous. That means you need to handle it as [class]Promise instance, usually by adding [js]await before function call.
Options
The [prop]options object has the following mandatory property:
[prop]target,[type]string. Target directory. If a directory is missing, it will be created.
and the following optional properties:
[prop]cleanup,[type]boolean. Iftrue, target directory will be emptied before exporting icons. Default isfalse.[prop]autoHeight,[type]boolean. Iftrue, icons will have dimensions matching[attr]viewBox. Iffalse, icons will have height set to[str]1em. Default istrue.[prop]includeAliases,[type]boolean. Generates files for aliases. Default istrue.[prop]includeChars,[type]boolean. Generates files for characters, such as[file]f00.svgfor icon that has character[str]f00assigned to it. Default isfalse.[prop]log,[type]boolean. Iftrue, function logs process. Default isfalse.
Example
src: libraries/tools/export/directory.ts
title: 'example.ts'
这篇文档对你有帮助吗?
谢谢你的反馈!