How do I parse CSS background-image
, which supports multiple values, which may be none
and functions (e.g. url()
and linear-gradient()
) with multiple comma-separated arguments? I can't seem to do this correctly with regexps. A good test case is as follows:
linear-gradient(top left, red, rgba(255,0,0,0))
, url(a)
, image(url(b.svg), 'b.png' 150dpi, 'b.gif', rgba(0,0,255,0.5))
, none
Which I'd want to convert to the following array:
[
"linear-gradient(top left, red, rgba(255,0,0,0))"
, "url(a)"
, "image(url(b.svg), 'b.png' 150dpi, 'b.gif', rgba(0,0,255,0.5))"
, "none"
]