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

icon: support svg, webp and optimization #398

Open
Atinux opened this issue Nov 20, 2020 · 2 comments
Open

icon: support svg, webp and optimization #398

Atinux opened this issue Nov 20, 2020 · 2 comments

Comments

@Atinux
Copy link
Member

Atinux commented Nov 20, 2020

It would be nice to also support static/icon.svg is available, I think we could use sharp for transformation.

const sharp = require("sharp")

sharp('static/icon.svg')
  .png()
  .toFile("{buildDir}/icon.png")
  .then(function(info) {
    console.log(info)
  })
  .catch(function(err) {
    console.log(err)
  })
@pi0
Copy link
Member

pi0 commented Nov 21, 2020

Actually we use jimp-lite for PWA module to reduce installation requirements. Supporting sharp if installed could be nice feature since this way we may also optimize and reduce size as well.

@pi0 pi0 mentioned this issue Nov 30, 2020
@pi0 pi0 changed the title [icon] Handle icon.svg Nov 30, 2020
@Coinhexa
Copy link

Coinhexa commented Apr 18, 2024

It would be nice to also support static/icon.svg is available, I think we could use sharp for transformation.

const sharp = require("sharp")

sharp('static/icon.svg')
  .png()
  .toFile("{buildDir}/icon.png")
  .then(function(info) {
    console.log(info)
  })
  .catch(function(err) {
    console.log(err)
  })

Sorry this is not very clear
As per the documentation I cannot find the icon accepting a callback function to supply a bunch of icons anywhere so where do you put all this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants