Remove extra code
This commit is contained in:
@ -49,58 +49,3 @@ const {} = Astro.props;
|
||||
document.getElementById("menu")?.classList.add("hidden");
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function insertTwConfig() {
|
||||
var config = {
|
||||
extend: {
|
||||
colors: {
|
||||
clifford: "#da373d",
|
||||
},
|
||||
fontFamily: {
|
||||
sans: "monospace",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
var configScript = document.createElement("script");
|
||||
configScript.setAttribute("data-tw-config", "");
|
||||
var inlineScript = document.createTextNode(`
|
||||
tailwind.config = {
|
||||
theme: ${JSON.stringify(config)}
|
||||
}
|
||||
`);
|
||||
configScript.appendChild(inlineScript);
|
||||
document.head.appendChild(configScript);
|
||||
}
|
||||
|
||||
function insertTwScript() {
|
||||
var twScript = document.createElement("script");
|
||||
twScript.src = "https://cdn.tailwindcss.com";
|
||||
twScript.setAttribute("data-tw-script", "");
|
||||
twScript.onload = function () {
|
||||
insertTwConfig();
|
||||
};
|
||||
|
||||
document.head.appendChild(twScript);
|
||||
}
|
||||
|
||||
function updateTailwindCSS() {
|
||||
const scripts = document.querySelectorAll(
|
||||
"[data-tw-config], [data-tw-script]"
|
||||
);
|
||||
if (scripts && scripts.length) {
|
||||
scripts.forEach(function (tag) {
|
||||
tag.parentNode.removeChild(tag);
|
||||
});
|
||||
}
|
||||
|
||||
insertTwScript();
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
attachEvent("[data-aw-update-tailwind]", "click", function (elem) {
|
||||
updateTailwindCSS();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user