Comments (2)
Export is done with @iconify/tools
package.
Sample code:
const tools = require('@iconify/tools');
(async () => {
// Import icons from directory 'svg'
const collection = await tools.ImportDir('svg');
// Clean up and optimise all icons
await collection.promiseAll((svg) => tools.SVGO(svg));
// Export as components
await tools.ExportComponent(collection, 'icon-components', {
sources: false,
// Set to true to generate CommonJS modules
commonjs: false,
});
})();
That code imports all icons from directory 'svg'. Then it optimises icons. Then it exports them as components to directory 'icon-components' with ES export syntax (change 'commonjs' option to true to export CommonJS modules).
I've just noticed that components export is not listed in documentation, so I'll add it. Until then you can see list of options for ExportComponent function in source code: https://github.com/iconify/tools/blob/master/src/export/component.js
Examples for importing and optimising icons are in documentation for Iconify Tools package: https://docs.iconify.design/tools/node/
from iconify.
Very nice, thanks for the quick response! I was almost starting to create my own script for that but I'll rather use the existing API 👍
from iconify.
Related Issues (20)
- Tailwindcss - Svelte - CMS HOT 3
- svelte OfflineIcon broken with 3.1.6 HOT 2
- Typescript complains HOT 9
- api changes HOT 5
- width and height is not matched correctly when setting with a decimal HOT 1
- Icon collection request: Bitcoin Icons HOT 3
- Package `@iconify/icons-material-symbols-light` not published to npm HOT 1
- Iconify on Svelte problem - Cannot find module HOT 1
- ✨ Align syntax for icons HOT 2
- Penpot integration HOT 2
- bug[React]: Icon Component does not render icon on first render when using `loadIcons` to preload HOT 5
- iconExists() not working on deployed site HOT 2
- [DEP0166] DeprecationWarning HOT 10
- [BUG] Deprecation Warning on Nuxt.js build due to package.json export HOT 2
- Workerd SSR issues HOT 1
- Hey I found an Issue !! HOT 2
- iconify/vue 使用addCollection加载图标集 还会向远程服务器发起请求吗 我想就将图标集打包到项目中
- Release of icons with android library HOT 8
- @iconify/tailwindcss redundant code HOT 16
- 在uniapp中怎么使用unocss+iconify实现图标展示啊? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iconify.