Installations
npm install @daipeng7/rollup-plugin-iconfont
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
18.20.2
NPM Version
10.5.0
Score
53.3
Supply Chain
85.1
Quality
72.8
Maintenance
25
Vulnerability
95.4
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (65.13%)
Nunjucks (34.29%)
Shell (0.58%)
Developer
daipeng7
Download Statistics
Total Downloads
7,007
Last Day
8
Last Week
133
Last Month
565
Last Year
5,684
GitHub Statistics
2 Stars
12 Commits
1 Forks
3 Watching
1 Branches
2 Contributors
Bundle Size
2.10 MB
Minified
493.77 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.6
Package Id
@daipeng7/rollup-plugin-iconfont@3.0.6
Unpacked Size
36.60 kB
Size
9.86 kB
File Count
25
NPM Version
10.5.0
Node Version
18.20.2
Publised On
22 May 2024
Total Downloads
Cumulative downloads
Total Downloads
7,007
Last day
-94.2%
8
Compared to previous day
Last week
-45%
133
Compared to previous week
Last month
2.7%
565
Compared to previous month
Last year
647.9%
5,684
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
11
Dev Dependencies
25
@daipeng7/rollup-plugin-iconfont
Use svg files to build iconfont files(ttf,woff2,woff,eot,svg), css file, js data file and html-preview file.
Features:
- Iconfont output formats: WOFF2, WOFF, EOT, TTF and SVG.
- Generates CSS file, js data file, html-preview file.
- Supports webpack and hot reloading at devlopment time. Iconfont files and css file will be rebuilt while any svg file changed or added, then page will refresh.
- Supports running by nodejs directly.
- Fixed output files with the same svg files. It means that if the svg files are not changed, all the output files(ttf,woff,css...) will not change, even though you build them again.
- High iconfont precision.
Install:
npm install -D @daipeng7/rollup-plugin-iconfont
Usage:
You can use it by nodejs directly or use it in webpack
1. Use by nodejs directly:
build/svg2font.js:
1var IconfontWebpackPlugin = require("@daipeng7/rollup-plugin-iconfont"); 2var path = require("path"); 3var dir = "test/web_project/"; 4var options = { 5 svgs: resolve("src/assets/svgs/*.svg"), 6 fontsOutput: resolve("src/style/iconfont/fonts"), 7 cssOutput: resolve("src/style/iconfont/index.css"), 8 fontName: "custom-iconfont", 9 jsOutput: false, 10 htmlOutput: false, 11 template: "scss", 12 // Font loads the absolute path. If not set, the relative path will be automatically calculated based on `cssOutput` and `fontsOutput`. 13 // cssFontPath: '', 14 // iconFont name prefix 15 cssPrefix: "ift", 16}; 17 18IconfontWebpackPlugin(options).buildStart();
Then you can run this command to build iconfont by svg:
1node build/svg2font.js
Or you can set this command to script of package.json, and run it by npm.
2. Use by webpack:
1var IconfontWebpackPlugin = require("@daipeng7/rollup-plugin-iconfont"); 2var dir = "test/web_project/"; 3 4module.exports = { 5 //... others 6 plugins: [ 7 IconfontWebpackPlugin({ 8 svgs: path.join(dir, "svgs/*.svg"), 9 svgs: resolve("src/assets/svgs/*.svg"), 10 fontsOutput: resolve("src/style/iconfont/fonts"), 11 cssOutput: resolve("src/style/iconfont/index.css"), 12 fontName: "custom-iconfont", 13 jsOutput: false, 14 htmlOutput: false, 15 template: "scss", 16 cssFontPath: "style/iconfont/fonts", 17 cssPrefix: "ift", 18 watch: false, 19 }), 20 ], 21};
Options
svgs
(required)
Type: String
File path(s) or glob(s) to svg icons. Recommend to use .svg like this: /src/project/src/.svg, this can watch svgs by directory.
fontsOutput
(required)
Type: String
Destination for generated font files (directory).
cssOutput
(required)
Type: String
Destination for generated css file (file name).
fontName
Type: String
Default value: iconfont
The font family name (e.g. font-family: 'iconfont'
).
htmlOutput
Type: String
Default value: [path of cssOutput] + /font-preview.html
. Or false
value.
Destination for generated html-preview file (file name). If false
, no html and js output.
template
Type: String
Default value: css
Type of built in style templates ('css', 'scss', 'scss-mixins') or path to custom template.
formats
Type: Array of String
Default value: ['svg', 'ttf', 'eot', 'woff2', 'woff']
The output iconfont formats.
cssPrefix
Type: String
Default value: fontName
Css className prefix.
jsOutput
Type: String
Default value: undefined.
Path of a js file which contains all svg contents. Optional.
jsPrefix
Type: String
Default value: '/_ eslint-disable _/\n'
Js file content prefix.
cssFontPath
Type: String
Default value: path.relative(path.dirname(options.cssOutput), options.fontsOutput);
Font url path in cssOutput
file.
success
Type: Function
Default value: undefined
Iconfonts be created.
watch
Type: Boolean
Default value: undefined
Watch file change.
Please refer to:
https://www.npmjs.com/package/svgicons2svgfont
https://www.npmjs.com/package/svg2ttf
https://www.npmjs.com/package/ttf2eot
https://www.npmjs.com/package/ttf2woff
https://www.npmjs.com/package/ttf2woff2
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
9 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
1.4
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More