Was looking through this solution:
https://github.com/medialize/sass.js/
And after much trial and error I got it to work when converting a scss string that looks something like this:
var testScss1 = '$testColour1: #ff0000' +
'.box { color: $testColor1 }';
var sassWithVariables = new Sass();
sassWithVariables.compile(testScss1, function (result) {
// result.text is defined and converts perfectly
});
But this example with an import to a file called _demo.scss, will not work and I want to throw my chair across the room!
var testScss2 = '@import "_demo";';
var sassWithImports = new Sass();
sassWithImports.compile(testScss2, function (result) {
/*
get this error:
ERROR Error: file to import not found or unreadable: _demo
Current dir:
on line 1 of stdin
>> @import "_demo";
*/
});