For sass this is not necessary, usually ... but, yes it is possible, there is a javascript library https://github.com/medialize/sass.js/ , you can start here https://github.com/medialize/sass .js / blob / master / docs / getting-started.md
You can embed <link > , <style> tags, or influence DOM elements to apply styles; these are standard JavaScript features.
It must be remembered that compiling sass is a resource-intensive operation. If the application is small and not loaded, for some reason and no. Tasks in real life are different.
<script src="dist/sass.js"></script> <script> var scss = '$someVar: 123px; .some-selector { width: $someVar; }'; sass.compile(scss, function(result) { console.log(result); }); </script>