question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: generate static css icon

See original GitHub issue

Sometimes especially when working with non vue components one needs to have icons defined at css level e.g.

.my-icon-stats {
    background: transparent        url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgc3Ryb2tlPSIjN0Y4QzhEIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMC41IDZWNC41aC01di41MzJhMSAxIDAgMCAwIC4zNi43NjhsMS43MTggMS40MzJhMSAxIDAgMCAxIDAgMS41MzZMNS44NiAxMC4yYTEgMSAwIDAgMC0uMzYuNzY4di41MzJoNVYxMCIvPjxyZWN0IHg9IjEuNSIgeT0iMS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIHJ4PSIyIi8+PC9nPjwvc3ZnPg==)
        no-repeat center;
    background-size: 16px 16px;
    height: 16px;
    opacity: 0.87;
    width: 16px;
    max-width: 16px;
    display: inline-block;
}

then it can be used as <span class="my-icon-stats"></span> even without Vue or other framework. This will not be useful for every framework combination but will also allow for this library to be used with no framework as well.

I guess this might be possible with unplugin-icons on demand via special command or syntax, especially since most of the svg extraction is done.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
userquincommented, Oct 9, 2021

And here the code:

imagen

1reaction
userquincommented, Dec 1, 2021

@husayt closing this since it has been included on unocss, if you want still this behavior open a new one issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom icon in static website - css - Stack Overflow
I am new to this sort of thing so might be wrong but as I understand it I made the new icon as...
Read more >
Icons Static Site Generator - Nicepage
Generate your own static website with the best free Static Website Generator of 2022. Use the biggest collection of 10000+ static web page...
Read more >
Creating a Maintainable Icon System with Sass - CSS-Tricks
We can use that here to create one version of our icons in our Sass map, using a placeholder for our color values....
Read more >
How To Animate Icons - W3Schools
Learn how to use icons to make an animated effect. ... A function called chargebattery() does all the replacing and displaying of icons....
Read more >
Add Social Share Buttons to Your Static Site Without Tracking
In this article we're going to quickly build social share icons that ... site generator we're only going to be dealing with HTML,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found