I have found a solution myself that works for me. I'm also using Sass, and with it I have found a base64 encode plugin. With it, I can write svg in my CSS which is then encoded to base64. And I can also use variables. The SASS code now looks like this:
background: url('data:image/svg+xml;base64,'
+ base64Encode('<svg xmlns="http://www.w3.org/2000/svg"><line x1="0" y1="0" x2="100%" y2="100%" stroke="#{$color-line}" stroke-width="1" /><line x1="100%" y1="0" x2="0" y2="100%" stroke="#{$color-line}" stroke-width="1" /></svg>'));
The base64 plugin is found here: URL- or Base64- encode strings in Compass/SASS