{"id":17344777,"url":"https://github.com/franzheidl/sass-inline-svg","last_synced_at":"2025-07-19T02:31:55.379Z","repository":{"id":36032084,"uuid":"40328546","full_name":"franzheidl/sass-inline-svg","owner":"franzheidl","description":"Inline url-encoded SVG with Sass. Optional variable string replacement included!","archived":false,"fork":false,"pushed_at":"2017-10-11T13:49:19.000Z","size":14,"stargazers_count":21,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-15T06:42:03.773Z","etag":null,"topics":["inline-svg","ruby","sass","sass-inline-svg","svg","svg-icons"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franzheidl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-06T21:51:41.000Z","updated_at":"2019-10-22T10:25:02.000Z","dependencies_parsed_at":"2022-08-21T01:20:21.997Z","dependency_job_id":null,"html_url":"https://github.com/franzheidl/sass-inline-svg","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/franzheidl/sass-inline-svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzheidl%2Fsass-inline-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzheidl%2Fsass-inline-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzheidl%2Fsass-inline-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzheidl%2Fsass-inline-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franzheidl","download_url":"https://codeload.github.com/franzheidl/sass-inline-svg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzheidl%2Fsass-inline-svg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265876881,"owners_count":23842956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inline-svg","ruby","sass","sass-inline-svg","svg","svg-icons"],"created_at":"2024-10-15T16:26:59.250Z","updated_at":"2025-07-19T02:31:55.362Z","avatar_url":"https://github.com/franzheidl.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sass-Inline-Svg\n\n[![Gem Version](https://badge.fury.io/rb/sass_inline_svg.svg)](http://badge.fury.io/rb/sass_inline_svg)\n\nInline url-encoded SVG with Sass. Optional variable string replacement included!\n\nThis is a Ruby Gem to be used with Ruby Sass, a version of this for node/npm-based environments with node-sass lives here: [sass-inline-svg-utf8](https://github.com/franzheidl/sass-inline-svg-utf8)\n\n\n## Installation\n\n    gem install sass_inline_svg\n\nAdd this line to your application's Gemfile:\n\n    gem 'sass_inline_svg'\n\n\n\n## Usage\n\nSass-inline-svg adds a `inline_svg` function you can use with Sass. It url-encodes the contents of the specified file and inlines it in your CSS (Url-encoded SVG is about 30% smaller than base64).\n\n###Basic\n\n    .my-thing {\n        background-image: inline_svg('my-file.svg');\n    }\n\nWhen working with plain Sass, you'll have to use the full path to the svg file, when using Rails the path will be resolved by the Rails asset pipeline.\n\n\n###Replacing Variable Strings\n\nReplacing variable strings in SVG when inlining them with Sass makes sense e.g. if you need multiple variants of the same graphic with different fill colors.\n\nWith Sass-Inline-Svg you only need __one__ source svg file with a variable string for `fill`:\n\n    …\n    \u003cpolygon fill=\"fillcolor\" points=\"[…] \"/\u003e\n    …\n\nThe variants needed can be created during inlinig with Sass. Pass a Sass map of replacements as a second parameter:\n\n    .my-thing {\n        background-image: inline_svg('my-file.svg', ( fillcolor: '#fff' ));\n    }\n\nThis will replace all occurences of `fillcolor` in your SVG with `#fff`:\n\n    …\n    \u003cpolygon fill=\"#fff\" points=\"[…]\"/\u003e\n    …\n\n__Note:__ If you use `$`- or `@`-prefixed variable names in your SVG or if you want to replace an existing hex color, you'll have to quote the keys in your raplement Sass map:\n\n    .my-thing {\n        background-image: inline_svg('my-file.svg', ( '$fillcolor': '#fff' ));\n    }\n    \nor\n\n    .my-thing {\n        background-image: inline_svg('my-file.svg', ( '#000': '#fff' ));\n    }\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzheidl%2Fsass-inline-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranzheidl%2Fsass-inline-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzheidl%2Fsass-inline-svg/lists"}