Skip to content

Commit 247098d

Browse files
authored
Further expand browser documentation and mention it in the README (#1973)
1 parent f0f00a6 commit 247098d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## 1.63.0
22

3+
### JavaScript API
4+
5+
* Dart Sass's JS API now supports running in the browser. Further details and
6+
instructions for use are in [the README](README.md#dart-sass-in-the-browser).
7+
38
### Embedded Sass
49

510
* The Dart Sass embedded compiler is now included as part of the primary Dart

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ Or even bundled with all its dependencies:
189189
</script>
190190
```
191191
192+
Since the browser doesn't have access to the filesystem, the [`compile()`] and
193+
`compileAsync()` functions aren't available for it. If you want to load other
194+
files, you'll need to pass a [custom importer] to [`compileString()`] or
195+
[`compileStringAsync()`]. The [legacy API] is also not supported in the browser.
196+
197+
[`compile()`]: https://sass-lang.com/documentation/js-api/functions/compile
198+
[`compileAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileAsync
199+
[custom importer]: https://sass-lang.com/documentation/js-api/interfaces/StringOptionsWithImporter#importer
200+
[`compileString()`]: https://sass-lang.com/documentation/js-api/functions/compileString
201+
[`compileStringAsync()`]: https://sass-lang.com/documentation/js-api/functions/compileStringAsync
202+
[legacy API]: #legacy-javascript-api
203+
192204
#### Legacy JavaScript API
193205
194206
Dart Sass also supports an older JavaScript API that's fully compatible with
@@ -197,8 +209,8 @@ Dart Sass also supports an older JavaScript API that's fully compatible with
197209
and will be removed in Dart Sass 2.0.0, so it should be avoided in new projects.
198210
199211
[Node Sass]: https://github.com/sass/node-sass
200-
[`render()`]: https://sass-lang.com/documentation/js-api/modules#render
201-
[`renderSync()`]: https://sass-lang.com/documentation/js-api/modules#renderSync
212+
[`render()`]: https://sass-lang.com/documentation/js-api/functions/render
213+
[`renderSync()`]: https://sass-lang.com/documentation/js-api/functions/renderSync
202214
203215
Sass's support for the legacy JavaScript API has the following limitations:
204216

0 commit comments

Comments
 (0)