Web Icons with No External Libraries! (🙅 No More Font Awesome)

Поділитися
Вставка
  • Опубліковано 26 сер 2024
  • Don't you hate when you're using Font Awesome, and it loads 500KB of JavaScript just to render 3 ICONS? You don't have to rely on big fat external libraries to do it for you! You can do it all by yourself, just grab the SVG and you're good to go! Watch the video to learn more (what big external libraries DON'T want you to know...)
    The site I was using for the icons:
    iconify.design/
    🌐 ericmurphy.xyz/
    Affiliate links to services I use:
    www.vultr.com/... Get a VPS to host your website or server.

КОМЕНТАРІ • 127

  • @ChumX100
    @ChumX100 3 роки тому +14

    You're missing the whole point of Iconify. Their library is just about 13kb and it replaces the icon tags with svgs automatically, by loading them dynamically from an API. It also caches the loaded icons locally so that they are only loaded once and new requests and pages that use the same icons won't incurr any further overhead.

  • @schlepers
    @schlepers 3 роки тому +14

    Thanks alot man. I was able to increase my Google lighthouse performance a bit by swapping out of the AwesomeFont kit code vs SVG. Much appreciation!!

  • @DoompyGames
    @DoompyGames Рік тому +4

    That's the most useful tip I have heard in a while, thank you sir. I found literally zero sources on how to get rid of the bloat introduced by font-awesome. In a plain nextjs application, with the different setup strategies for font-awesome or fort-awesome, the minimum you can achieve is an additional 20kb loaded for all of your pages. That refers to around 10% of additional chunk size per page.

  • @williammcdermed7287
    @williammcdermed7287 Рік тому +1

    Thank you for your response. I failed to mention how helpful your video was because it gave me the info to just tackle the whole use of svg's in a very direct way. You are right the only thing that was helpful from FA was the svg. So thanks again!

  • @PLuffy-ke7ho
    @PLuffy-ke7ho Рік тому +2

    This was awesome! I tried to use Font Awesome but couldn't get the kit to load properly with my site. This is a nice alternative and taught me more about a different attribute. Many thanks!

  • @moaaz_hassan
    @moaaz_hassan Рік тому +1

    Thanks but what about size of code i tried to put the svg icons on my website on blogger i noticed that code size increased from 40kb to 50kb how to fix it.

  • @madtho
    @madtho 3 роки тому +3

    Awesome, thank you. Had to tweak some styles to work with the svg, but looks and works great.

  • @AnthonyJackman
    @AnthonyJackman 9 місяців тому

    Awesome video! Something so simple. I am running into the same thing you did with FA. I am only using 2 icons out of FA. The difference in my project is that I am doing a build using SASS. Your way may seem a little management work on the developer, but that effort pays dividends with site users. Thank you for making this!

  • @gopalloharnew5948
    @gopalloharnew5948 2 роки тому +1

    That's what I wanted !

  • @christianworld2
    @christianworld2 5 місяців тому

    Thanks man. This video is really helpful. Have really tried others but didn't work until i met this video

  • @MuhammadAkbar-sy7zm
    @MuhammadAkbar-sy7zm Рік тому

    Thank you. I have been looking for this solution, avoiding those unnecessary external libraries

  • @gaetandesignz4599
    @gaetandesignz4599 3 роки тому +2

    Great video !!! It makes your website load faster, but it takes a bunch of lines that a boring thing sometimes exp if you have consecutively five.

  • @jeslela
    @jeslela Рік тому +2

    Thanks for this simple and straight to the point video! 👏🏽

  • @coodie
    @coodie Рік тому +1

    Great video explanation. Loved that you showed the amount of resources before and after. Thanks for the video!

  • @ArsenTech
    @ArsenTech 3 роки тому +1

    Iconify Fixed My Website Icons, Thanks So Much

  • @codebasic8558
    @codebasic8558 2 роки тому +2

    This is wonderful! Thank you very much, good sir!

  • @GulfJobSeeker_Vacancies
    @GulfJobSeeker_Vacancies 2 роки тому +1

    Thanks a lot for giving this simple but logical solution.

  • @gopalloharnew5948
    @gopalloharnew5948 2 роки тому +1

    How to use svg's in css without smashing it into html ?
    like keeping it in another file .. but the fill becomes a problem !

  • @bettercalldelta
    @bettercalldelta Рік тому

    You could probably still use the fontawesome tags but make a server-side script to "compile" it into what will actually be served to the client.

  • @jeffbarnhart6441
    @jeffbarnhart6441 Рік тому

    love how you go into dev tools. perfect video.

  • @PhilipProchazka
    @PhilipProchazka 3 роки тому +1

    yeah that is what i knew also before, i wanted to actually create my own font library, I do also fight here to get more than font awesome into my new angular template, so i guess it will be easier to stay into my known practics i understand and that buch will go propably down. you can also store those svgs into a folder and call them by name i guess after setting to include & require that folder and than callin those svg elements

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому

      Yeah that's another more efficient method if you don't mind doing that yourself 👍

  • @williammcdermed7287
    @williammcdermed7287 Рік тому

    Thanks man. I got the same result without "identify", just grab the SVG code from FA and parse as you did.

    • @EricMurphyxyz
      @EricMurphyxyz  Рік тому

      Yes you don't need iconify, they just make it a little easier than going through the Dev tools

  • @HeitorYT
    @HeitorYT Рік тому

    I use preact for my projects and using local svg is the best thing. It doesn't show any errors.

  • @hamzakhiar3636
    @hamzakhiar3636 Рік тому

    I'm kind of thinking on making a community plug-in on for instance figma where designers design icons and stuff and getting them with JavaScript as svg's or png's and replace font awesome

  • @bartickmaiti3049
    @bartickmaiti3049 3 роки тому +1

    Thanks man.

  • @septimusforster
    @septimusforster 9 місяців тому

    Is there a workaround to subscribe multiple times on a UA-cam channel? This one definitely deserves it.

  • @digitalminister5687
    @digitalminister5687 3 роки тому

    You save cellular data as well this way! Thank you for the video!

  • @mouctechy
    @mouctechy Рік тому

    thank you my dude was looking an alternative to optimize my portfolio 👏👏

  • @sonoftroy8572
    @sonoftroy8572 Рік тому

    Very informative, I didn’t think to monitor the amount of data being loaded using font awesome. I’v learned something today. Thanks

  • @9squares
    @9squares Рік тому

    Just what I was looking for, Thank you

  • @helloanshu4080
    @helloanshu4080 Рік тому +1

    thanks mate!

  • @dominikchynoradsky4228
    @dominikchynoradsky4228 3 роки тому +1

    Good thinking sir, thank you.

  • @skilllearn904
    @skilllearn904 3 роки тому +1

    thanks broyher thats help me alot ,good work

  • @Gyannea
    @Gyannea 11 місяців тому

    This is where I want to go, but I could not get the font size to work. I had to delete the width and height and do width and height in css instead. Is that because my svg icon width and height units are px?

  • @timawid
    @timawid 2 роки тому

    actually font awesome gives me some problem not letting the icon apear. i wont ever use fontawesome
    Thanks❤❤

  • @mohamed-tm8kr
    @mohamed-tm8kr Рік тому

    thank you bro, you saved my life
    i love you

  • @acke5180
    @acke5180 3 роки тому

    Great job! You just gave me a homeWork.. :) Subscribed. Keep up the good work!

  • @torg27
    @torg27 Рік тому

    this is really brilliant!! thank you!!

  • @TheTimeProphet
    @TheTimeProphet 3 роки тому

    I do a similar thing, but you can put all your svg icons into one file and give them an id and use xlink to show them. This way you only have one file to load, as it gets cached. eg
    This code would show the icon with the id of hat. The svg file can have hundreds of icons with a different id. Of course you have to set the width and height in css, as SVG has to have a width and a height. Let me know if you want to know more

    • @TheTimeProphet
      @TheTimeProphet 2 роки тому

      @Entertainment Roller Coaster I am always around

    • @TheTimeProphet
      @TheTimeProphet 2 роки тому

      @Entertainment Roller Coaster Once you made your file. Use the first code I posted to show it. eg
      Just change the xlink line to whatever icon you want to show eg

    • @TheTimeProphet
      @TheTimeProphet 2 роки тому

      @Entertainment Roller Coaster You have all your icons in one file. That means your icons will load faster as it is one call to the file. As for the individual icons you can either make them yourself in illustrator and export the data, or download and use other peoples svgs. I do a bit of both. the important part is the viewBox, and the paths. Personally I would optimise your svg online before putting it in the file. This removes all the unnessary groups which you don't need on the web. I also remove colours. Then you can colour your svg using css.

  • @atmanvisual190
    @atmanvisual190 3 роки тому

    Lovely video, man. Thanks a lot.

  • @jake445
    @jake445 2 роки тому +1

    This kind of video is what I needed. I am very much a beginner, but I wondered why I have to link huge external libraries, when I needed only 1-2 icons. Lots of unused codes in the libraries, and damn, now I am using svg, it makes codes appear larger, but i just embed it inside span tag and collapse it.

  • @mtycoder
    @mtycoder 3 роки тому

    im using boxicons and is open source, besides that with that library they easily allow you to copy the SVG file, give them a try.,

  • @wolfenrico
    @wolfenrico Рік тому

    Awesome. Thanks!

  • @TheNomanAhmed
    @TheNomanAhmed 4 роки тому +3

    Thanks Eric this is great video. I had been using FA in many of my projects and this is a great way to optimize the size. But i am just wondering how would you approach the problem if we have to use FA in the pseudo elements in css. Would there be a better way to do it ?

    • @EricMurphyxyz
      @EricMurphyxyz  4 роки тому +4

      Thanks! Yes, copy the SVG code and convert it to a data URL using a site like this: yoksel.github.io/url-encoder/ Now you can use it like a background-image in CSS. You have to manually style the pseudo-element it to make it look right so not be as convenient as FA, but still works well.

    • @TheNomanAhmed
      @TheNomanAhmed 4 роки тому

      @@EricMurphyxyz Thanks for the reply. I will try this approach. 👍🏽

  • @nyuentreprise3402
    @nyuentreprise3402 2 роки тому

    Thank you very much buddy !🙌

  • @deadlock7946
    @deadlock7946 Рік тому

    Just wow. Thank you so much!!!

  • @nelsonazolukwamprojects
    @nelsonazolukwamprojects 3 роки тому

    I thought the browser downloads the files once, or is downloaded on every request?

  • @limehouseblues
    @limehouseblues 3 роки тому

    thank-you, this was very helpful

  • @TarunChkravarthi
    @TarunChkravarthi 3 роки тому +4

    That really looks cool! Any suggestions to avoid too much svg code which could get hard to identify the specific icons when we are working on big projects or massive codebase?
    Just like creating our own icon-fonts using any svg code we choose for?
    Keep going!

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому +13

      Thanks! You can move all the SVG code to a separate file and replace it with inside the SVG tag.

    • @muhammadhaiqal531
      @muhammadhaiqal531 Рік тому

      @@EricMurphyxyz how can I do that?

    • @EricMurphyxyz
      @EricMurphyxyz  Рік тому

      @@muhammadhaiqal531 I explained it pretty clearly? Copy the SVG code to a separate file, name it something like your-icon.svg and then reference it with the tag I showed above

    • @muhammadhaiqal531
      @muhammadhaiqal531 Рік тому

      @@EricMurphyxyz yes I did exactly that, but somehow it doesn't work, but I figured a workaround so yeah

    • @caesarliftz
      @caesarliftz Рік тому

      @@muhammadhaiqal531 i tried too, but it didn't work

  • @tameemsani7387
    @tameemsani7387 2 роки тому

    it was really help full ....thank you

  • @frank-lx2yn
    @frank-lx2yn 8 місяців тому

    thank you very much!
    🙏🙏🙏🙏

  • @olga_lc
    @olga_lc 2 роки тому

    Thanks a lot, that was helpful!

  • @mrtmore1038
    @mrtmore1038 2 роки тому

    Thank you!

  • @j.m.p.8739
    @j.m.p.8739 Рік тому

    remove the xlmns and let's see if it loads the icon.

  • @rakeshmanathana
    @rakeshmanathana 3 роки тому

    Very helpful. Thank you.

  • @giovannimichel5506
    @giovannimichel5506 2 роки тому

    Thank you for the intel.

  • @R.A.G.U.L
    @R.A.G.U.L 2 місяці тому

    You are a fucking genius broo☠Even after 3years you solved my problem

  • @biyanwho
    @biyanwho 2 роки тому +1

    The real question is, how do you display this icon as pseudo element

    • @craigburton4447
      @craigburton4447 2 роки тому

      Could you perhaps save the SVG to your images folder and put it's URL in the content " " property? I haven't tried it, but that's what I would try first

    • @bettercalldelta
      @bettercalldelta Рік тому

      turn it into a data url

  • @madihamuhammad4633
    @madihamuhammad4633 3 роки тому

    Thanks man.u saved my time .

  • @digitalminister5687
    @digitalminister5687 3 роки тому

    Iconmonstr has many cool icons as well

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому

      Nice, great resource! Never heard about this before

  • @musicallife3062
    @musicallife3062 3 роки тому

    Thanks bro I was not able to use font awesome
    Thanks for this vedio

  • @nikachkhobadze7710
    @nikachkhobadze7710 3 роки тому

    Really useful. Thanks

  • @jimohyinka4895
    @jimohyinka4895 Рік тому

    this looks nice, but I think a link would be needed?

  • @wolfenrico
    @wolfenrico 3 роки тому

    Thats great! Thanks!

  • @alexhardao2742
    @alexhardao2742 9 місяців тому

    wow nice tip!

  • @samuelthomas5494
    @samuelthomas5494 3 роки тому

    Thank you for sharing this video :-)

  • @ishaanagarwal
    @ishaanagarwal 3 роки тому

    Thank you so much!!! ❤️

  • @tomslaterdesignillustratio4391
    @tomslaterdesignillustratio4391 2 роки тому

    Genius!

  • @sharonamaina3553
    @sharonamaina3553 2 роки тому

    Thank you

  • @dc-tlc9654
    @dc-tlc9654 2 роки тому

    Thanks 👍

  • @greggregory9029
    @greggregory9029 2 роки тому

    you helped me! thanks

  • @marcelositonio2495
    @marcelositonio2495 3 місяці тому

    Awesome :)

  • @MicRodrgz
    @MicRodrgz 11 місяців тому

    thanks for the idea!
    subscribe done 👍

  • @vishveshpratapsingh
    @vishveshpratapsingh 2 роки тому

    Thanks bro

  • @alexdem98
    @alexdem98 2 роки тому

    Very nice!

  • @md.ridwanulhassanrafi6851
    @md.ridwanulhassanrafi6851 3 роки тому

    thanks a lot 🤍🤍

  • @aneeshrc6848
    @aneeshrc6848 2 роки тому

    Thank you bro it's working 💓💓💓😊😊😊😊😊😊

  • @gudneighbour
    @gudneighbour 6 місяців тому

    thanks

  • @thakurtilak2860
    @thakurtilak2860 Рік тому

    Thank you, you have shown easy path otherwise I was getting box instead of icon i desired.Thanks again to solve it without going through all that process.By do by, u decoded font-awesome secret so its coming for u.

  • @jaykay5486
    @jaykay5486 3 роки тому

    Would this work with the code from Illustrator SVG,

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому

      I would assume so, should work with any SVG code.

  • @agentsmith2189
    @agentsmith2189 2 роки тому

    ty

  • @kedigiller111
    @kedigiller111 2 роки тому

    really helpfull, thanks a lot

  • @luckybairagi7294
    @luckybairagi7294 2 роки тому

    which OS are you using??

  • @asdffacil
    @asdffacil 2 роки тому

    Nice tip

  • @peterpeter8421
    @peterpeter8421 4 місяці тому

    たすかったよ ありがとう

  • @nelsonazolukwamprojects
    @nelsonazolukwamprojects 3 роки тому

    Wonderful content though. never knew that existed.

  • @samo4502
    @samo4502 2 роки тому

    niceeeeeee thanks and i like it

  • @Nature-calm-song
    @Nature-calm-song Рік тому

    Awesome

  • @ilovancristian
    @ilovancristian 2 роки тому

    thx

  • @MarttyLovato
    @MarttyLovato Рік тому

    genio te quiero mucho

  • @softwarereviews2496
    @softwarereviews2496 3 роки тому

    Thanks Dear
    Give me to great skills

  • @Ayomikun
    @Ayomikun 3 роки тому

    I'm probably just being silly, but is this definitely allowed?

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому +1

      Font Awesome is under an open source license, so it's all good.

    • @Ayomikun
      @Ayomikun 3 роки тому +1

      @@EricMurphyxyz Thanks, this is fucking awesome then 🤣

  • @Ilyas_Alrai
    @Ilyas_Alrai 2 роки тому

    But as programmer you allways want a way simplify things and let machine do all stuff for you instead of copying every single icon code. I think javascript itself is a bloated language but we use it anyways because it does the job.

    • @EricMurphyxyz
      @EricMurphyxyz  2 роки тому +1

      There are more efficient ways to use icons without bringing in the bloated Font Awesome library. I know react-icons for React is good, but I'm not sure of an easier way to do it in just HTML. That said, I only really need around 5 icons for a given website and copy & pasting a small amount of icons is not a big deal for me. The performance savings are worth it for me, but it's up to you.

  • @golf_wangg48
    @golf_wangg48 2 роки тому

  • @ck0024
    @ck0024 3 роки тому

    I use boxicon

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому

      Wow, there's a lot of great icon resources I never knew about

  • @kamdanibwp
    @kamdanibwp 8 місяців тому

    جزاک اللہ خیرا

  • @sovereignlivingsoul
    @sovereignlivingsoul Рік тому

    that is a good suggestion until they close the sight or change their policies, using programs like GIMP and Inkscape to create your own icons would be a useful skill to learn.

    • @EricMurphyxyz
      @EricMurphyxyz  Рік тому +1

      There are still tons of ways to get the svg code without that specific website, it's not just something they can change their policies and remove. Making your own icons may be a useful skill but nobody is going to hand render a Facebook icon for their website

    • @sovereignlivingsoul
      @sovereignlivingsoul Рік тому

      @@EricMurphyxyz yeah, i know, i think knowing how to insert svg files into their website is a god skill, that's all, your advice is sound.

  • @donmorris4506
    @donmorris4506 3 роки тому

    Dude, just get a font awesome pro license and then can include just the icons you want.

    • @EricMurphyxyz
      @EricMurphyxyz  3 роки тому +1

      Even the official Font Awesome library brings in a bunch of unnecessary JavaScript. React Icons is a lot more light weight.

  • @timawid
    @timawid 2 роки тому

    Thanks bro