sass.js
sass.js copied to clipboard
Web Assembly
Will you be adding web assembly builds soon? Or is the Web Assembly MVP not sufficient enough for libsass?
I have not dabbled with WebAssembly yet and I don't plan to in the sort term, but I'm sure sass.js will eventually be a WebAssembly thing.
I've tried my luck with WebAssembly but wasn't able to make native-wasm
work.
-s WASM=1 -o test.html
will generate eveything needed for execution, but I get the following error:
trying binaryen method: native-wasm
failed to compile wasm module: RangeError: WebAssembly.Module(): Wasm compilation exceeds internal limits in this context for the provided arguments
Uncaught no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods
Firefox and Chrome can't run the generated test.wasm
directly either, they abort because of a version mismatch. … will try again in a few weeks.
Via a tweet I noticed that @AshKyd made some changes to sass.js to get wasm to work.
@AshKyd do you want to send a PR for that? Does this still work in browsers not supporting WASM?
@rodneyrehm Was more a learning experience. It doesn't work in Node 8 (not sure why), and there's no fallback either so it's not mergeable without more work.
I can't commit to anything, but if nobody else picks it up I might have another look when I have some time. :)
FYI: https://github.com/sass/node-sass/pull/2220
Thanks for the nudge @mgreter - I've just released a beta for WASM: 0.11.0-beta.1
Please try it out and tell me if something goes wrong with the relative loading of libsass.wasm
. Not sure if I should consider this a (potentially) breaking change or not…
Hey
I am currently testing the WASM beta and at least for a simple use case it works fine with no issues.
My use case is a Browser-based Monaco Editor sass => sass.js => inject to styles -WYSIWYG editor.
I guess we'll have to try some more (and probably produce a bigger build), because IE11 doesn't support WASM…
no native wasm support detected
no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods
https://gist.github.com/surma/b2705b6cca29357ebea1c9e6e15684cc might help with switching from this archaic grunt build thing to webpack with support for wasm.
https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webassemblymvp/ suggests that Edge is now supporting WASM as well
Can we get a new WebAssembly build after all these updates? :)
Can we get a new WebAssembly build after all these updates? :)
were you using the 0.11.0-beta.1 build already?
Yes, it is about 2 seconds faster for my setup.