-
Notifications
You must be signed in to change notification settings - Fork 182
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
[auto-icons] Allow any image than .png #1089
Comments
JPEG's can't have transparent pixels, so if you use one you're probably breaking Chrome's guidelines if you use one: https://developer.chrome.com/docs/webstore/images#icon-size
Doesn't
WXT already automatically discovers icons without the auto-icons module. Why add support for this in auto-icons? What's your use-case? |
I mean if I have a base icon of .jpg. or any other. Then convert it to .png using the toFile or toFormat function: sharp(input)
.toFile('output.png', (err, info) => { ... }); |
Your code baseIconPath: resolve(wxt.config.srcDir, 'assets/icon.png'), only scans for .png files and not .jpg or .bmp. What I mean is if there IS any .bmp or jpg or .jpeg you CONVERT them into a .png using the .toFormat function so I can keep using .jpg inside my app without having 2 files 1 for icon and 1 for using in the extension. I would suggest having a name like icon.* * is the extension can be any .jpg, .bmp, jpeg, jpg etc. then you use the .toFormat function to convert them into a VALID .png file. For only use with icons. |
OK, so you just want to add glob support to |
Yeah sure I can do it! I wanna add support for JPEG (.jpg, .jpeg, .jpe, .jfif) But really in the end you convert them into a .png. I'll make a pr. 👍 |
It's true that transparency will not work if trying to use with .jpg etc. Then you will have to use a .png from the start. But this is just for images that do not use transparency because that doesn't make sense to use jpg if you need transparency etc.. |
True. But yeah it's nice with options. |
It can be configured in import "@wxt-dev/auto-icons";
import { defineConfig } from "wxt";
// See https://wxt.dev/api/config.html
export default defineConfig({
modules: ["@wxt-dev/auto-icons"],
autoIcons: {}
}); My solution is overwirte the module as a new module import module from "@wxt-dev/auto-icons";
import { resolve } from "node:path";
import { defineWxtModule } from "wxt/modules";
export default defineWxtModule({
...module,
setup: (wxt, options) => {
module.setup?.(wxt, {
baseIconPath: resolve(wxt.config.publicDir, "images/icon.svg"),
grayscaleOnDevelopment: false,
sizes: [256, 128, 96, 48, 32, 16],
...options
});
}
}); |
@breadgrocery as long as you extend |
No, it didn't. I even explicitly specify in the "types": ["naive-ui/volar", "unplugin-icons/types/vue", "@types/chrome", "@wxt-dev/auto-icons"] It do generate the following content in
It works when using side-effect import. |
Hmm, interesting, works for me. Was using it earlier today 🤔. If you've got a reproduction I'd appreciate you opening a separate issue. |
My {
"extends": "./src/.wxt/tsconfig.json",
"compilerOptions": {
"types": ["naive-ui/volar", "unplugin-icons/types/vue", "@types/chrome"]
}
} And I find out that I must configure {
"extends": "./src/.wxt/tsconfig.json",
"files": ["./wxt.config.ts"]
"compilerOptions": {
"types": ["naive-ui/volar", "unplugin-icons/types/vue", "@types/chrome"]
}
} |
Feature Request
Would be nice to allow any .jpeg, .bmp etc.
So I don't have to have duplicate images in different formats.
I think sharp has a toFormat function that can output .png no matter what input is used.
And add some input file option or a glob for icon path search.
The text was updated successfully, but these errors were encountered: