forked from medialize/sass.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sass.worker.html
53 lines (49 loc) · 1.96 KB
/
sass.worker.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sass.js Worker Console</title>
</head>
<body>
<h1>Sass.js Worker Console</h1>
<p>This document loads the <em>worker</em> Sass.js. Please open your browser's DevTools to use the API.</p>
<h2>Try the following example:</h2>
<pre>// when loading the worker api via script[src$="/sass.js"] it's a safe bet the worker
// will be found relative to that file. In any other case you'd have to define where
// the worker is located before initializing Sass:
// Sass.setWorkerUrl('dist/sass.worker.js');
var sass = new Sass();
sass.writeFile('testfile.scss', '@import "sub/deeptest";\n.testfile { content: "loaded"; }', function() {
console.log('wrote "testfile.scss"');
});
sass.writeFile('sub/deeptest.scss', '.deeptest { content: "loaded"; }', function() {
console.log('wrote "sub/deeptest.scss"');
});
sass.options({ style: Sass.style.expanded }, function(result) {
console.log("set options");
});
sass.compile('@import "testfile";', function(result) {
console.log("compiled", result.text);
});</pre>
<script src="dist/sass.js"></script>
<script>
// when loading the worker api via script[src$="/sass.js"] it's a safe bet the worker
// will be found relative to that file. In any other case you'd have to define where
// the worker is located before initializing Sass:
// Sass.setWorkerUrl('dist/sass.worker.js');
var sass = new Sass();
sass.writeFile('testfile.scss', '@import "sub/deeptest";\n.testfile { content: "loaded"; }', function() {
console.log('wrote "testfile.scss"');
});
sass.writeFile('sub/deeptest.scss', '.deeptest { content: "loaded"; }', function() {
console.log('wrote "sub/deeptest.scss"');
});
sass.options({ style: Sass.style.expanded }, function(result) {
console.log("set options");
});
sass.compile('@import "testfile";', function(result) {
console.log("compiled", result.text);
});
</script>
</body>
</html>