Use escape-svg() function#29077
Conversation
4b525f5 to
1cd89a5
Compare
1cd89a5 to
3b990b4
Compare
|
I think it would be cleaner if Doing so would also mean those using the variables containing the SVG markup elsewhere don't have to know to wrap the use of the variable in |
|
Hmm, perhaps there's another function or mixin we could use to handle that? Or is this over-engineering? I like the idea of keeping the variables super clean and the source Sass. @mixin svg-bg($variable) {
background-image: escape-svg($variable);
}
.element {
@include svg-bg($variable-name);
} |
|
@mdo You'd need multiple mixins or an additional parameter to your suggested the mixin to accommodate the SVG variables being used with |
|
Using a mixin would make the code less readable imo and we lose the ability to use our property order linting. Edit: and we 'll need more mixins, like @voltaek mentioned. I've moved the functions to our codebase instead of the
|
|
Gotcha, makes sense! I’d like to push a couple changes to the docs page before merging to clearly explain and illustrate the function. |
Use
escape-svg()to escape<,>&#characters. This makes the_variables.scssmore readable & maintainable. Also includes a tiny property optimalization for the select background (see https://www.diffchecker.com/7IBMI8dF).Fixes #29065