@fabric-ds/icons
v0.6.8
Published
Fabric's icon set
Downloads
8,497
Keywords
Readme
Fabric Icons
The icon set for Fabric, imported from the Figma project.
Note that the icons in the "raw" folder in this repository should never be used directly, as they aren't optimized.
Usage
Elements
Using NPM package
Install dependencies
You will need to install both Fabric Elements and Lit Element which is the library we use for custom elements
npm install lit @fabric-ds/icons
Import elements
Import the individual element file, importing will load the component. Once imported, run your script through whatever bundling process your app uses (Rollup, Esbuild, etc) after which the component can be used in the page.
import '@fabric-ds/icons/elements/attachment-16';
import '@fabric-ds/icons/elements/attachment-24';
<f-icon-attachment16></f-icon-attachment16>
<f-icon-attachment24></f-icon-attachment24>
Development
Updating the icons
Icons should never be added or edited manually in this repository, as the source of truth is in Figma.
Figma access token
If you are running the import script for the first time, it will prompt your for a Figma access token. The token is is required to access Figma's API. It can be generated on your Figma account settings page.
The import script may store the token to a local file, so you won't have to supply the token again on subsequent runs.
Import script
To update the icons, run the following script. If it has a valid Figma access token (see above), it will proceed to download all the icons as SVG files.
./scripts/figma-import.js
Local preview
You can open a local preview of the icons. Use this to verify that the icons looks as they should. Run the following command.
npm run start
Publishing
If everything looks correct, publish the changes.
npm publish
git push --follow-tags
Eik
Eik versions for each of Vue, Elements and React icons are automatically created in the ./dist folder when builds are run. Eik configuration is based on values in package.json (name, version and eik keys) and running Eik publish will publish everything in the dist folder to Eik under the path https://assets.finn.no/pkg/{name}/{version}/
.
Example Paths:
- React:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/react/icons.min.js
- Vue:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/vue/icons.min.js
- Custom Elements:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/elements/icons.min.js
- Raw ads svg at size 16:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/16/ads.svg
- Raw air con svg at size 24:
https://assets.finn.no/pkg/@fabric-ds/icons/v1/24/air-con.svg
Troubleshooting
Auth
If the scripts authentication issues, you could try to create a new access token and delete the local file .FIGMA_TOKEN
before running the script again.
Figma project structure
The script is probably not resilient to changes in the structure of the Figma project. Changes there will probably require an update of the import script.