Giter VIP home page Giter VIP logo

Comments (5)

meduzen avatar meduzen commented on August 28, 2024 1

svg_spritesheet() is a shortcut for <div syle="display:none;">@include('svg.your_spritesheet')</div>, and you don’t even need to include your spritesheet to be able to use @icon directive.

Indeed, having one or two (optionals) parameters for svg_spritesheet() would be a nice feature:

  • no parameter: you call the default spritesheet from config/blade-svg.php;
  • first parameter (string): you call another spritesheet;
  • second parameter (array of icon slugs): you filter the spritesheet to include only the icon set (so, an array) specified.

Example: svg_spritesheet('svg.socials', ['instagram', 'twitter', 'ello']);

For now, I work with multiple spritesheets in the front-end workflow side, with gulp-svg-sprite), which covers my current use case.

Maybe I’ll try to build something and PR for the version with one argument. I currently wait for @adamwathan ’s feedback of the one I made (as I’m noob to the Git contribution thing and not especially a PHP-guy).

from blade-icons.

adamwathan avatar adamwathan commented on August 28, 2024 1

Going to close this for now as I don't personally have any intention on adding it, although I would still look at a PR if someone were to submit one.

Part of me wants to remove spritesheet support entirely at some point, because I think directly inlining your SVGs is simpler with some benefits and not any real downsides. I probably won't but I will at least de-emphasize it in the docs.

Seems to be becoming the recommended approach in other circles:

https://css-tricks.com/pretty-good-svg-icon-system/

from blade-icons.

mauriciomateus avatar mauriciomateus commented on August 28, 2024

I agree, those parameters would be a good adition.

As to filtering the icons as you propose in the third parameter, I think it would be even better being able to pass an array of spritesheets. It would be convenient to split icons, for example, social_icons_spritesheet.svg, form_labels_spritesheet.svg, etc.

That way, we would not need to import a huge set of icons every time, but just render the ones we need, optimizing the amount of html rendered.

Other than that, the package is great. I like the fact that the spritesheet can be a blade view, allowing for html sintax highlighting in code editors, as well as auto completion. It does not force us to use the .svg extension.

from blade-icons.

adamwathan avatar adamwathan commented on August 28, 2024

Would totally look at a PR for this 👍🏻 I'm personally only ever using maybe a dozen icons on a site so I'm fine with including the whole spritesheet, but even so I use the inline option 99% of the time anyways.

from blade-icons.

meduzen avatar meduzen commented on August 28, 2024

That’s what I went for since a couple of weeks, too, after having discussed this specific point with a former colleague. Not sure a spritesheet couldn’t be a benefit for some projects, by the way (no examples come in mind right now).

from blade-icons.

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.