30 lines
687 B
JavaScript
30 lines
687 B
JavaScript
|
module.exports.createDocument = function(stylesheet, content) {
|
||
|
return `
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Spotify results</title>
|
||
|
<style>${stylesheet}</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
${content}
|
||
|
</body>
|
||
|
</html>
|
||
|
`;
|
||
|
}
|
||
|
|
||
|
module.exports.$ = function(name, content, classList) {
|
||
|
return {
|
||
|
toString: () => `<${name}${classList && classList.length ? ` class="${classList.join(',')}"` : ''}>${content ? content.toString() : ''}</${name}>`,
|
||
|
append: function ($el) {
|
||
|
content = content ? content + $el.toString() : $el.toString();
|
||
|
return this;
|
||
|
},
|
||
|
html: function(text) {
|
||
|
content = text;
|
||
|
return this;
|
||
|
}
|
||
|
};
|
||
|
}
|