svg2font-cli 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/cli.js +37 -37
  2. package/lib/index.js +36 -36
  3. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -170,7 +170,7 @@ const buildDemoCss = () => `/* Basic utility classes */
170
170
  display: none;
171
171
  }
172
172
 
173
- /* 页面布局 */
173
+ /* Page layout */
174
174
  .main {
175
175
  padding: 30px 100px;
176
176
  width: 960px;
@@ -235,14 +235,14 @@ const buildDemoCss = () => `/* Basic utility classes */
235
235
  }
236
236
 
237
237
  .icon_lists .svg-icon {
238
- /* 通过设置 font-size 来改变图标大小 */
238
+ /* Change icon size by setting font-size */
239
239
  width: 1em;
240
- /* 图标和文字相邻时,垂直对齐 */
240
+ /* Vertical alignment when icon is adjacent to text */
241
241
  vertical-align: -0.15em;
242
- /* 通过设置 color 来改变 SVG 的颜色/fill */
242
+ /* Change SVG color/fill by setting color */
243
243
  fill: currentColor;
244
- /* path stroke 溢出 viewBox 部分在 IE 下会显示
245
- normalize.css 中也包含这行 */
244
+ /* Hide path and stroke overflow outside viewBox in IE
245
+ This is also included in normalize.css */
246
246
  overflow: hidden;
247
247
  }
248
248
 
@@ -497,7 +497,7 @@ const buildDemoCss = () => `/* Basic utility classes */
497
497
  text-decoration: underline;
498
498
  }
499
499
 
500
- /* 代码高亮 */
500
+ /* Code highlighting */
501
501
  /* PrismJS 1.15.0
502
502
  https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
503
503
  /**
@@ -729,19 +729,19 @@ ${unicodeIcons}
729
729
 
730
730
  </ul>
731
731
  <div class="article markdown">
732
- <h2 id="unicode-">Unicode 引用</h2>
732
+ <h2 id="unicode-">Unicode Reference</h2>
733
733
  <hr>
734
734
 
735
- <p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
735
+ <p>Unicode is the most basic way to use fonts on the web. Features:</p>
736
736
  <ul>
737
- <li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
738
- <li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
737
+ <li>Supports dynamic adjustment of icon size, color, etc. like regular fonts.</li>
738
+ <li>Does not support multi-color by default. Multi-color icons will be automatically converted to single color.</li>
739
739
  </ul>
740
740
  <blockquote>
741
- <p>Note: Multi-color icons are supported via SVG symbol method or color font icon mode.</p>
741
+ <p>Note: Multi-color icons are supported via the SVG symbol method or color font mode.</p>
742
742
  </blockquote>
743
- <p>Unicode 使用步骤如下:</p>
744
- <h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
743
+ <p>Usage steps:</p>
744
+ <h3 id="-font-face">Step 1: Copy the generated <code>@font-face</code> code</h3>
745
745
  <pre><code class="language-css"
746
746
  >@font-face {
747
747
  font-family: '${fontName}';
@@ -750,7 +750,7 @@ ${unicodeIcons}
750
750
  url('${fileBase}.ttf${versionSuffix}') format('truetype');
751
751
  }
752
752
  </code></pre>
753
- <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
753
+ <h3 id="-iconfont-">Step 2: Define the iconfont styles</h3>
754
754
  <pre><code class="language-css"
755
755
  >.iconfont {
756
756
  font-family: "${fontName}" !important;
@@ -760,7 +760,7 @@ ${unicodeIcons}
760
760
  -moz-osx-font-smoothing: grayscale;
761
761
  }
762
762
  </code></pre>
763
- <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
763
+ <h3 id="-">Step 3: Select an icon and use its character code on the page</h3>
764
764
  <pre>
765
765
  <code class="language-html"
766
766
  >&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
@@ -776,20 +776,20 @@ ${fontClassIcons}
776
776
 
777
777
  </ul>
778
778
  <div class="article markdown">
779
- <h2 id="font-class-">font-class 引用</h2>
779
+ <h2 id="font-class-">Font Class Reference</h2>
780
780
  <hr>
781
781
 
782
- <p>font-class Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
783
- <p>与 Unicode 使用方式相比,具有如下特点:</p>
782
+ <p>Font class is a variant of Unicode usage that addresses the issue of Unicode being unintuitive and unclear in meaning.</p>
783
+ <p>Compared to Unicode usage, it has the following advantages:</p>
784
784
  <ul>
785
- <li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
786
- <li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
785
+ <li>Compared to Unicode, it is semantically clear and more intuitive to write. You can easily tell what icon this is.</li>
786
+ <li>Because icons are defined using classes, when you need to replace an icon, you only need to modify the Unicode reference in the class.</li>
787
787
  </ul>
788
- <p>使用步骤如下:</p>
789
- <h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
788
+ <p>Usage steps:</p>
789
+ <h3 id="-fontclass-">Step 1: Include the generated fontclass CSS file in your project:</h3>
790
790
  <pre><code class="language-html">&lt;link rel="stylesheet" href="./${fileBase}.css"&gt;
791
791
  </code></pre>
792
- <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
792
+ <h3 id="-">Step 2: Select an icon and use its class name on the page:</h3>
793
793
  <pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
794
794
  </code></pre>
795
795
  <blockquote>
@@ -803,22 +803,22 @@ ${symbolIcons}
803
803
 
804
804
  </ul>
805
805
  <div class="article markdown">
806
- <h2 id="symbol-">Symbol 引用</h2>
806
+ <h2 id="symbol-">Symbol Reference</h2>
807
807
  <hr>
808
808
 
809
- <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
810
- 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
809
+ <p>This is a new way to use icons and represents the future mainstream approach, which is currently the recommended method by the platform. For more information, refer to this <a href="">article</a>.
810
+ This approach creates an SVG sprite collection. Compared to the other two methods, it has the following features:</p>
811
811
  <ul>
812
- <li>支持多色图标了,不再受单色限制。</li>
813
- <li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
814
- <li>兼容性较差,支持 IE9+,及现代浏览器。</li>
815
- <li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
812
+ <li>Supports multi-color icons, no longer limited to single colors.</li>
813
+ <li>Through some techniques, supports font-like styling via <code>font-size</code> and <code>color</code>.</li>
814
+ <li>Lower browser compatibility, supports IE9+ and modern browsers.</li>
815
+ <li>Browser SVG rendering performance is generally lower than PNG.</li>
816
816
  </ul>
817
- <p>使用步骤如下:</p>
818
- <h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
817
+ <p>Usage steps:</p>
818
+ <h3 id="-symbol-">Step 1: Include the generated symbol JavaScript file in your project:</h3>
819
819
  <pre><code class="language-html">&lt;script src="./${fileBase}.js"&gt;&lt;/script&gt;
820
820
  </code></pre>
821
- <h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
821
+ <h3 id="-css-">Step 2: Add the general CSS code (include once):</h3>
822
822
  <pre><code class="language-html">&lt;style&gt;
823
823
  .icon {
824
824
  width: 1em;
@@ -829,7 +829,7 @@ ${symbolIcons}
829
829
  }
830
830
  &lt;/style&gt;
831
831
  </code></pre>
832
- <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
832
+ <h3 id="-">Step 3: Select an icon and use it on the page:</h3>
833
833
  <pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
834
834
  &lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
835
835
  &lt;/svg&gt;
@@ -3342,7 +3342,7 @@ const ttfToEot = (arr) => {
3342
3342
  if (haveOS2 && haveName && haveHead) break;
3343
3343
  }
3344
3344
  if (!(haveOS2 && haveName && haveHead)) {
3345
- throw new Error("Required section not found");
3345
+ throw new Error("Required font table sections not found (missing one or more: OS/2, name, head)");
3346
3346
  }
3347
3347
  const eot = Buffer.concat([
3348
3348
  out,
@@ -3497,7 +3497,7 @@ const generateIconfont = async (options) => {
3497
3497
  const runCli = async () => {
3498
3498
  const program = new commander.Command().name("svg2font").description("Convert SVG icons into a downloadable iconfont zip (similar to iconfont.cn).").option(
3499
3499
  "-i, --input <path>",
3500
- "Directory or glob that resolves to svg files",
3500
+ "Directory or glob pattern for SVG files",
3501
3501
  DEFAULT_CLI_OPTIONS.input
3502
3502
  ).option(
3503
3503
  "-o, --output <dir>",
package/lib/index.js CHANGED
@@ -152,7 +152,7 @@ const buildDemoCss = () => `/* Basic utility classes */
152
152
  display: none;
153
153
  }
154
154
 
155
- /* 页面布局 */
155
+ /* Page layout */
156
156
  .main {
157
157
  padding: 30px 100px;
158
158
  width: 960px;
@@ -217,14 +217,14 @@ const buildDemoCss = () => `/* Basic utility classes */
217
217
  }
218
218
 
219
219
  .icon_lists .svg-icon {
220
- /* 通过设置 font-size 来改变图标大小 */
220
+ /* Change icon size by setting font-size */
221
221
  width: 1em;
222
- /* 图标和文字相邻时,垂直对齐 */
222
+ /* Vertical alignment when icon is adjacent to text */
223
223
  vertical-align: -0.15em;
224
- /* 通过设置 color 来改变 SVG 的颜色/fill */
224
+ /* Change SVG color/fill by setting color */
225
225
  fill: currentColor;
226
- /* path stroke 溢出 viewBox 部分在 IE 下会显示
227
- normalize.css 中也包含这行 */
226
+ /* Hide path and stroke overflow outside viewBox in IE
227
+ This is also included in normalize.css */
228
228
  overflow: hidden;
229
229
  }
230
230
 
@@ -479,7 +479,7 @@ const buildDemoCss = () => `/* Basic utility classes */
479
479
  text-decoration: underline;
480
480
  }
481
481
 
482
- /* 代码高亮 */
482
+ /* Code highlighting */
483
483
  /* PrismJS 1.15.0
484
484
  https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
485
485
  /**
@@ -711,19 +711,19 @@ ${unicodeIcons}
711
711
 
712
712
  </ul>
713
713
  <div class="article markdown">
714
- <h2 id="unicode-">Unicode 引用</h2>
714
+ <h2 id="unicode-">Unicode Reference</h2>
715
715
  <hr>
716
716
 
717
- <p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
717
+ <p>Unicode is the most basic way to use fonts on the web. Features:</p>
718
718
  <ul>
719
- <li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
720
- <li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
719
+ <li>Supports dynamic adjustment of icon size, color, etc. like regular fonts.</li>
720
+ <li>Does not support multi-color by default. Multi-color icons will be automatically converted to single color.</li>
721
721
  </ul>
722
722
  <blockquote>
723
- <p>Note: Multi-color icons are supported via SVG symbol method or color font icon mode.</p>
723
+ <p>Note: Multi-color icons are supported via the SVG symbol method or color font mode.</p>
724
724
  </blockquote>
725
- <p>Unicode 使用步骤如下:</p>
726
- <h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
725
+ <p>Usage steps:</p>
726
+ <h3 id="-font-face">Step 1: Copy the generated <code>@font-face</code> code</h3>
727
727
  <pre><code class="language-css"
728
728
  >@font-face {
729
729
  font-family: '${fontName}';
@@ -732,7 +732,7 @@ ${unicodeIcons}
732
732
  url('${fileBase}.ttf${versionSuffix}') format('truetype');
733
733
  }
734
734
  </code></pre>
735
- <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
735
+ <h3 id="-iconfont-">Step 2: Define the iconfont styles</h3>
736
736
  <pre><code class="language-css"
737
737
  >.iconfont {
738
738
  font-family: "${fontName}" !important;
@@ -742,7 +742,7 @@ ${unicodeIcons}
742
742
  -moz-osx-font-smoothing: grayscale;
743
743
  }
744
744
  </code></pre>
745
- <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
745
+ <h3 id="-">Step 3: Select an icon and use its character code on the page</h3>
746
746
  <pre>
747
747
  <code class="language-html"
748
748
  >&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
@@ -758,20 +758,20 @@ ${fontClassIcons}
758
758
 
759
759
  </ul>
760
760
  <div class="article markdown">
761
- <h2 id="font-class-">font-class 引用</h2>
761
+ <h2 id="font-class-">Font Class Reference</h2>
762
762
  <hr>
763
763
 
764
- <p>font-class Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
765
- <p>与 Unicode 使用方式相比,具有如下特点:</p>
764
+ <p>Font class is a variant of Unicode usage that addresses the issue of Unicode being unintuitive and unclear in meaning.</p>
765
+ <p>Compared to Unicode usage, it has the following advantages:</p>
766
766
  <ul>
767
- <li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
768
- <li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
767
+ <li>Compared to Unicode, it is semantically clear and more intuitive to write. You can easily tell what icon this is.</li>
768
+ <li>Because icons are defined using classes, when you need to replace an icon, you only need to modify the Unicode reference in the class.</li>
769
769
  </ul>
770
- <p>使用步骤如下:</p>
771
- <h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
770
+ <p>Usage steps:</p>
771
+ <h3 id="-fontclass-">Step 1: Include the generated fontclass CSS file in your project:</h3>
772
772
  <pre><code class="language-html">&lt;link rel="stylesheet" href="./${fileBase}.css"&gt;
773
773
  </code></pre>
774
- <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
774
+ <h3 id="-">Step 2: Select an icon and use its class name on the page:</h3>
775
775
  <pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
776
776
  </code></pre>
777
777
  <blockquote>
@@ -785,22 +785,22 @@ ${symbolIcons}
785
785
 
786
786
  </ul>
787
787
  <div class="article markdown">
788
- <h2 id="symbol-">Symbol 引用</h2>
788
+ <h2 id="symbol-">Symbol Reference</h2>
789
789
  <hr>
790
790
 
791
- <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
792
- 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
791
+ <p>This is a new way to use icons and represents the future mainstream approach, which is currently the recommended method by the platform. For more information, refer to this <a href="">article</a>.
792
+ This approach creates an SVG sprite collection. Compared to the other two methods, it has the following features:</p>
793
793
  <ul>
794
- <li>支持多色图标了,不再受单色限制。</li>
795
- <li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
796
- <li>兼容性较差,支持 IE9+,及现代浏览器。</li>
797
- <li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
794
+ <li>Supports multi-color icons, no longer limited to single colors.</li>
795
+ <li>Through some techniques, supports font-like styling via <code>font-size</code> and <code>color</code>.</li>
796
+ <li>Lower browser compatibility, supports IE9+ and modern browsers.</li>
797
+ <li>Browser SVG rendering performance is generally lower than PNG.</li>
798
798
  </ul>
799
- <p>使用步骤如下:</p>
800
- <h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
799
+ <p>Usage steps:</p>
800
+ <h3 id="-symbol-">Step 1: Include the generated symbol JavaScript file in your project:</h3>
801
801
  <pre><code class="language-html">&lt;script src="./${fileBase}.js"&gt;&lt;/script&gt;
802
802
  </code></pre>
803
- <h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
803
+ <h3 id="-css-">Step 2: Add the general CSS code (include once):</h3>
804
804
  <pre><code class="language-html">&lt;style&gt;
805
805
  .icon {
806
806
  width: 1em;
@@ -811,7 +811,7 @@ ${symbolIcons}
811
811
  }
812
812
  &lt;/style&gt;
813
813
  </code></pre>
814
- <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
814
+ <h3 id="-">Step 3: Select an icon and use it on the page:</h3>
815
815
  <pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
816
816
  &lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
817
817
  &lt;/svg&gt;
@@ -3285,7 +3285,7 @@ const ttfToEot = (arr) => {
3285
3285
  if (haveOS2 && haveName && haveHead) break;
3286
3286
  }
3287
3287
  if (!(haveOS2 && haveName && haveHead)) {
3288
- throw new Error("Required section not found");
3288
+ throw new Error("Required font table sections not found (missing one or more: OS/2, name, head)");
3289
3289
  }
3290
3290
  const eot = Buffer.concat([
3291
3291
  out,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg2font-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI and Node API to convert SVG icon sets into complete iconfont bundles (SVG/TTF/WOFF/WOFF2/EOT) with CSS, demos, and sprites - zero native dependencies",
5
5
  "keywords": [
6
6
  "svg",