Code Monkey home page Code Monkey logo

Comments (8)

kisenka avatar kisenka commented on May 20, 2024

@davidspiess #25 (comment)

from svg-sprite-loader.

princed avatar princed commented on May 20, 2024

Unfortunately we can't have automatic universal solution.
Angular is just widespread case of <base> usage, which is easy to automate.

from svg-sprite-loader.

davidspiess avatar davidspiess commented on May 20, 2024

Why not always use an absolute path like in the solution mentioned by @kisenka? Shouldn't that fix the <base> problem completely?
At the moment i'm using something like this

<use xlink:href="${ window.location.href.split('#')[0] + icon }"></use>

from svg-sprite-loader.

princed avatar princed commented on May 20, 2024

Because absolute path changes when navigation (using history API) happened, so we have to update xlink:hrefs of all existing icons, that's why we listen to custom spriteLoaderLocationUpdated event in order to do it on time.

So actually you need both second and third point from the comment.

from svg-sprite-loader.

davidspiess avatar davidspiess commented on May 20, 2024

Thanks for the clarification :) I didn't think about the history api. More docs about the <base> issue would be a great addition 👍

from svg-sprite-loader.

princed avatar princed commented on May 20, 2024

My pleasure :)
Let us know if you have any ideas on custom event API.

from svg-sprite-loader.

princed avatar princed commented on May 20, 2024

@davidspiess BTW, would you like to make a PR regarding #30?

from svg-sprite-loader.

davidspiess avatar davidspiess commented on May 20, 2024

@princed right now i'm quite busy, but i'll dive into it this weekend :)

from svg-sprite-loader.

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.