forked from medialize/sass.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsass.source.html
60 lines (57 loc) · 2.43 KB
/
sass.source.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
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sass.js Source Console</title>
</head>
<body>
<h1>Sass.js Source Console</h1>
<p>This document loads the <em>source</em> sass.js. You have to compile libsass using <code>grunt libsass:prepare libsass:build</code> before this will work. Please open your browser's DevTools to use the API.</p>
<h2>Try the following example:</h2>
<pre>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>
var Module = {
// emscripten is looking for "libsass.js.mem" (relative to this document by default),
// via the prefix we redirect that request relative to libsass.js
// see http://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html#emcc-memory-init-file
// NOTE: this is hard-coded to "dist/" in dist/sass.sync.js and irrelevant for dist/sass.worker.js
memoryInitializerPrefixURL: 'libsass/libsass/lib/',
// see http://kripken.github.io/emscripten-site/docs/getting_started/FAQ.html#how-can-i-tell-when-the-page-is-fully-loaded-and-it-is-safe-to-call-compiled-functions
onRuntimeInitialized: function() {
console.log("runtime initialized, ready to go!");
Sass._ready();
}
};
</script>
<script src="libsass/libsass/lib/libsass.js"></script>
<script src="src/sass.util.js"></script>
<script src="src/sass.options.js"></script>
<script src="src/sass.importer.js"></script>
<script src="src/sass.api.js"></script>
<script>
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>