This content originally appeared on DEV Community and was authored by FSCSS tutorials
Import FSCSS from javascript file
In my javascript file I do something like this:
//fscss.js
async function styleWith(){
let fscss = await import("https://wbf.tiiny.site/newFscss.js");
:root .box{
$rgb: %3([200,]);
$bg-color: #00F0F0;
}
newFscss = (`
.box{
%2(
Width,
Height[: 100px;])
Border: 4px solid $rgb!;
}
$(@keyframes box, .box &[ 3s linear infinite alternate]) {
0%{
Transform: rotateX(0);
}
100%{
Transform: rotateX(360deg);
}}
fscss.exec(newFscss).use;
}
styleWith();
Index.html:
<!--- index.html --->
<!DOCTYPE html>
<haed>
<script src='scripts/fscss.js'></script>
</head>
<body>
<div class='box'></div>
</body>
This content originally appeared on DEV Community and was authored by FSCSS tutorials

FSCSS tutorials | Sciencx (2025-02-05T19:16:02+00:00) How to Import FSCSS from javascript in HTML. Retrieved from https://www.scien.cx/2025/02/05/how-to-import-fscss-from-javascript-in-html/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.