Giter VIP home page Giter VIP logo

Comments (3)

SethFalco avatar SethFalco commented on July 28, 2024 2

Hey! Thanks for the feature request.

Just want to verify that we're experiencing the same thing here. When you say we "SVG sprite is not optimized", can you clarify what actually happens?

I've tested what happens with the Font Awesome 6 Solid SVG sprites, which throws the entire file away. This kind of makes sense given none of the symbols were used, therefore they all get removed, but indeed we should make it easier to work with sprites.

For now, a config like this should work for SVG sprites:

export default {
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          removeHiddenElems: false, // don't remove invisible elements
          removeUselessDefs: false, // don't remove unused symbols
          cleanupIds: false // don't remove symbol ids
        }
      }
    }
  ]
}

This takes Font Awesome 6 Solid down from 834.976 KiB to 808.786 KiB.

In general, we do support optimizing sprite packs though, but it's not obvious how to handle them. I think it'd be better to keep the default behavior as it is, but introduce documentation or a preset specific to this use-case.

Are your SVG sprites available publically so I can review the structure and how SVGO processes it?

from svgo.

danielghirasim avatar danielghirasim commented on July 28, 2024

Hello,

I Apologize for not including all the details.

I first tried using it through grunt-svgmin plugin then I went straight to using SVGO because it was giving me an empty svg file.

After using the config you provided it did actually work and it reduced the size from 80kb to ~70kb.

Thank you for clarifying!

P.S.: Unfortunately I cannot provide the SVG Sprite used since it's using Font Awesome Pro and some custom SVGs specific to the closed source project I am working on

from svgo.

XhmikosR avatar XhmikosR commented on July 28, 2024

You could try using https://github.com/twbs/icons/blob/main/bootstrap-icons.svg, although the file is supposed to be already optimized through svg-sprite: https://github.com/twbs/icons/blob/main/svg-sprite.json

I agree, a preset or clear instructions would help many people!

from svgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.