Skip to content

Commit

Permalink
style: modify output log issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 30, 2024
1 parent 135f84e commit ec9259e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,18 @@ export default async (options: SvgToFontOptions = {}) => {
}

if (options.website) {
const pageName = ['font-class', 'unicode', 'symbol'];
let fontClassPath = path.join(options.dist, 'index.html');
let unicodePath = path.join(options.dist, 'unicode.html');
let symbolPath = path.join(options.dist, 'symbol.html');
const pageNames = ['font-class', 'unicode', 'symbol'];
const htmlPaths: Record<string, string> = {};
// setting default home page.
const indexName = pageName.includes(options.website.index) ? pageName.indexOf(options.website.index) : 0;
pageName.forEach((name, index) => {
const _path = path.join(options.dist, indexName === index ? 'index.html' : `${name}.html`);
if (name === 'font-class') fontClassPath = _path;
if (name === 'unicode') unicodePath = _path;
if (name === 'symbol') symbolPath = _path;
const indexName = pageNames.includes(options.website.index) ? options.website.index : 'font-class';
pageNames.forEach(name => {
const fileName = name === indexName ? 'index.html' : `${name}.html`;
htmlPaths[name] = path.join(options.dist, fileName);
});
const fontClassPath = htmlPaths['font-class'];
const unicodePath = htmlPaths['unicode'];
const symbolPath = htmlPaths['symbol'];

// default template
options.website.template = options.website.template || path.join(__dirname, 'website', 'index.njk');
// template data
Expand Down Expand Up @@ -401,7 +401,7 @@ export default async (options: SvgToFontOptions = {}) => {
tempData._type = 'symbol';
const symbolHtmlStr = await createHTML(options.website.template, tempData);
fs.outputFileSync(symbolPath, symbolHtmlStr);
log.log(`${color.green('SUCCESS')} Created ${unicodePath} `);
log.log(`${color.green('SUCCESS')} Created ${symbolPath} `);
}

if (options.outSVGPath) {
Expand Down

0 comments on commit ec9259e

Please sign in to comment.