You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
/**
|
|
* Translates the list format produced by css-loader into something
|
|
* easier to manipulate.
|
|
*/
|
|
export default function listToStyles (parentId, list) {
|
|
var styles = []
|
|
var newStyles = {}
|
|
for (var i = 0; i < list.length; i++) {
|
|
var item = list[i]
|
|
var id = item[0]
|
|
var css = item[1]
|
|
var media = item[2]
|
|
var sourceMap = item[3]
|
|
var part = {
|
|
id: parentId + ':' + i,
|
|
css: css,
|
|
media: media,
|
|
sourceMap: sourceMap
|
|
}
|
|
if (!newStyles[id]) {
|
|
styles.push(newStyles[id] = { id: id, parts: [part] })
|
|
} else {
|
|
newStyles[id].parts.push(part)
|
|
}
|
|
}
|
|
return styles
|
|
}
|