-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: enable custom collections #12
Comments
I guess at this point, we might need to unify the behaviour and configurations in Here are two solutions that come to my mind,
The downside of solution one is that we probably end up with too many config files and for ppl who don't outsource their config, they can't benefit from the extension or other integrations. I am leaner to solution two, which I believe provides better DX and could also be useful if we are end with building a VS Code extension for UnoCSS and maybe for the future of Windi and others. The only thing is that we need to do a PoC of solution two to see if it's really feasible tho. |
Ok I made it https://github.com/antfu/unconfig, and it's working. You can see an example usage here https://github.com/antfu/unplugin-icons/blob/main/examples/vite-vue3/getConfig.ts It's currently using https://github.com/egoist/bundle-require which is based on esbuild, which I guess it's not compatible with VS Code extension env. We might need to switch to some pure JS solution like https://github.com/alangpierce/sucrase later. |
OK I understand the two approaches and the problem you're trying to solve by unifying the icon library configurations across the three tools we have. I'm trying to understand the last comment. I'll pull down and test out your example repo. I mostly don't understand if you expect the VSCode plugin to work (given your comment about esbuild/VSCode compat). The other thing I don't understand is how |
In this extension, we could call import { loadConfig } from 'unconfig'
const { config } = await loadConfig({ sources: [...] })
for (const c of config.customCollections) {
// ...
} I just made the UnoCSS extension using |
I am using some custom imported JSON icon sets to integrate font awesome pro with unocss/presetIcons like this: presetIcons({
scale: 1.2,
warn: true,
collections: {
'fa-solid': async () => JSON.parse(await fs.readFile('./icons/fa-solid.json', 'utf8')),
}
}), It would be great, if the extension would also show these as actual icons instead of just the svg content on hover (which comes from unocss intellisense). Here is an example with a free icon from that set: If it helps for testing, I can create a minimal reproduction repo with just a few icons in the JSON file @antfu. |
Hope unplugin-iconify-generator could help you! |
👋🏻 Hello! I (and Cypress) use your custom icons plugin via the Unplugin ecosystem. Thanks for all the great work! I'm interested in adding support for custom collections.
I'd be willing to implement it if you pointed me in the right direction.
The text was updated successfully, but these errors were encountered: