-
Notifications
You must be signed in to change notification settings - Fork 136
Description
First i tried v0.6.3 from CDN:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sass in browser</title>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/sass.js/0.6.3/sass.min.js"></script>
<!--script src="bower_components/sass.js/dist/sass.js"></script-->
<style id="csscode"></style>
<script>
//Sass.initialize('bower_components/sass.js/dist/sass.worker.js');
function compileCSS(color) {
//Sass.compile('$color: ' + color + '; h1 { color: $color; }', function(result){
//console.log('result: ' + result);
//});
var css = Sass.compile('$color: ' + color + '; h1 { color: $color; }');
console.log(css);
}
compileCSS('orange');
console.log('done......');
</script>
</head>
<body>
</body>
</html>The above writes to the console as expected:
SyntaxError: "use asm" is only meaningful in the Directive Prologue of a function body sass.min.js:1982:107
"pre-main prep time: 39 ms" sass.min.js:55:137
"h1 {
color: orange; }
" t:20:6
"done......"
Then i replace //cdnjs.cloudflare.com/ajax/libs/sass.js/0.6.3/sass.min.js with //cdnjs.cloudflare.com/ajax/libs/sass.js/0.6.3/sass.min.js now the output is as follows:
TypeError: b._worker is null
Finally i also tried: bower install sass.js -> bower sass.js#~0.8.1 install sass.js#0.8.1 and after that i use in the HTML:
<script src="bower_components/sass.js/dist/sass.js"></script>
and
Sass.initialize('bower_components/sass.js/dist/sass.worker.js');
the latest setting only sets css to undefined:
undefined t:19:6
"done......" t:22:6
SyntaxError: "use asm" is only meaningful in the Directive Prologue of a function body >sass.worker.js:1907:60
So how can i use my code with version 0.8.1 in browser? Notice using Sass.compile(source, callback) also result in ;undefined
Sass.compile('$color: ' + color + '; h1 { color: $color; }',function(result) {
console.log('result:' + result);
});
Does not generate any output other than:
"done......" t:25:6
SyntaxError: "use asm" is only meaningful in the Directive Prologue of a function body