How to separate css code blocks in javascript?
Following are some css in the serialised form:
const css = "body { background-color: lightblue; } h1 { color: white; text-align: center; } p { font-family: verdana; font-size: 20px; }"
How can I parse it and get it in the following form as array (along with adding whitespaces (preserving whitespaces. i.e. in formatted form):
const parsedCss = [
'body {
background-color: lightblue;
}',
'h1 {
color: white;
text-align: center;
}',
'p {
font-family: verdana;
font-size: 20px;
}',
]