From f5f6100d1aeaed5a26a96a73378c97c4b26bbd68 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 29 Sep 2020 01:39:48 +0800 Subject: [PATCH] feat: Add CLI more options. #48 --- src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.ts b/src/index.ts index 5d2e61b7..d10d6fad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -143,6 +143,14 @@ export type SvgToFontOptions = { } export default async (options: SvgToFontOptions = {}) => { + const pkgPath = path.join(process.cwd(), 'package.json'); + if (fs.pathExistsSync(pkgPath)) { + const pkg = require(pkgPath); + if (pkg.svgtofont) { + options = { ...options, ...pkg.svgtofont } + } + } + options.dist = options.dist || path.join(process.cwd(), 'fonts'); options.src = options.src || path.join(process.cwd(), 'svg'); options.unicodeStart = options.unicodeStart || 10000;