0
URLを返すSCSS関数を記述しようとしています。 (だからbackground-image: getURL(thing);
のように使うことができます)URLを構築するSass関数
難しいことは、argsをエスケープすることを含む、難しいことです。 #
は%23
になりますので、URLセーフです。
Sassでもこのようなことが可能ですか?
@function getURL($name, $color: #ffffff) {
// ???
}
// How I want it to work:
getURL('foo');
// returns: url("http://example.com/foo.png?color=%23ffffff")
// And if possible, this would be cool
// (accepting any color type, and turning it into a hex color):
getURL('bar', rgb(255,0,0));
// returns: url("http://example.com/bar.png?color=%23ff0000")