Skip to content

Sass function to encode SVG as a data uri without it being in base64

Notifications You must be signed in to change notification settings

pablonoel/sass-svg-uri

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

SASS SVG URI

This is just a simple module with Jakob Eriksen's function for easy use in projects. Uses Hugo Giraudel's str-replace function to replace invalid characters in the SVG as a data uri.

Usage

Just import the file and use the function, no dependencies, SASS Version.

@import "sass-svg-uri/svg-uri"

.icon
    background-image: svg-uri('<svg xmlns="http://www.w3.org/2000/svg"> ... </svg>')

Would output:

.icon {
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E% ... %3C/svg%3E");
}

To know more:

About

Sass function to encode SVG as a data uri without it being in base64

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 100.0%