Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Documentation on Local Icon Pack #53

Closed
zaha opened this issue Sep 20, 2022 · 1 comment · Fixed by #106
Closed

Improve Documentation on Local Icon Pack #53

zaha opened this issue Sep 20, 2022 · 1 comment · Fixed by #106
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@zaha
Copy link

zaha commented Sep 20, 2022

Hi!

While trying to create my own local icon package I noticed the docs for astro/icon don't reflect the latest changes in the import path here:
https://github.com/natemoo-re/astro-icon#local-icon-packs

import { createIconPack } from "astro-icon";

should be

import { createIconPack } from "astro-icon/pack";

according to the changelog.

Also, the following comment could be improved:

// Resolves `heroicons` dependency and reads SVG files from the `heroicons/outline` directory
export default createIconPack({ package: "heroicons", dir: "outline" });

Does this mean the icon will be searched for in src/icons/heroicons/outline?
I tried it like that but I'm getting a pretty long error message 😅

TypeError: String.prototype.startsWith called on null or undefined
at startsWith ()
at Proxy.pathToFileURL (node:internal/url:1474:20)
at eval (/node_modules/astro-icon/lib/createIconPack.ts:16:53)
at Module.load [as default] (/node_modules/astro-icon/lib/utils.ts:156:28)
at eval (/node_modules/astro-icon/lib/Icon.astro:26:52)
at Module.renderToIterable (/node_modules/astro/dist/runtime/server/render/astro.js:79:27)
at renderAstroComponentInline (/node_modules/astro/dist/runtime/server/render/component.js:75:52)
at renderAstroComponentInline.next ()
at Module.renderChild (/node_modules/astro/dist/runtime/server/render/any.js:25:5)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

I'm also missing the info whether it's possible to skip the dir parameter and put the icons directly into src/icons/heroicons/?

@stramel stramel added documentation Improvements or additions to documentation good first issue Good for newcomers labels Oct 20, 2022
@PersonalInfoHidden
Copy link

For me I just needed to import default like this:

import createIconPack from "astro-icon";

But I could also import the function like this:

import { createIconPack } from "astro-icon/lib/createIconPack";

However this did not work:

import { createIconPack } from "astro-icon/pack";

Strange 🤔

Also the Documentation on "Local Icon Packs" has two default exports which makes it difficult to follow, it would probably be best to put an "or" or separate the snippets as alternatives to communicate it better.

@stramel stramel added this to the v0.9 milestone May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants