-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (23 loc) · 800 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import Sassify from "./import.js";
let elementName = "sass-style";
if (!customElements.get(elementName)) {
class SASS extends HTMLElement {
constructor() {
super();
}
}
customElements.define(elementName, SASS);
}
const SassStyles = document.querySelectorAll("sass-style");
SassStyles.forEach(element => {
const sassified = Sassify(element.innerHTML);
const style = document.createElement("style");
style.innerText = sassified;
const output = document.createElement("div");
output.classList.add("output");
output.textContent = sassified;
element.parentElement.removeChild(element);
document.head.appendChild(style);
document.body.appendChild(output);
output.style.display="none";
});