-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile to WASM #33
Comments
Cool! I havn't really looked into wasm yet. What would be required to compile rsass into wasm? Does it have to be no-std? In that case, I guess some kind of callback-based handling would be needed for supporting The one dependency that could probably not be removed from such a "rsass core" would be nom. Is that possible to use in wasm? |
No, but some of the std APIs are stubbed out (like threading and atomics) or panic (filesystem).
yeap, but it need to be async, as the browser/node context is 100% async.
I think it should work in wasm. Wasm is a normal ISA (like x64/x86), but there are just basic bindings to the host system (like memory allocation), no filesystem and so forth (there are efforts to make an OS that can execute WASM binaries just like normal executables and also add bindings to fs, but that's offtopic). So as long as it is just using self contained rust code (and allocations) it should work. |
Hello, i'd like to up this Issue cause Im very interested in the feature Rsass has compared to Grass, I've been looking around in order to make a WASM version for Deno, and I believe Rsass supports way more stuff compared to Grass. There is something that can allow support for the Files (import etc..) Wasm-bindgen adds a way to load javascript function, you can basically use the Fs module on Node to load files and pass it as a Vec to Rust, that's what Grass does currently. I tried to change Rsass way of loading file but it's way different and my Rust is not that great, do you think it would be possible to make such changes to allow any WASM compatibility ? I made a wasm version for browsers and Deno using Grass, but it lacks many features that are present here. |
@chpio If you do not need runtime modified sass, i made the PR #163 for compile time macros. use rsass_macro::scss;
const STR: &'static str = scss!(r#"
.some-scss {
// blabla
}
"#); It works in my wasm dioxus web project. |
sass/node-sass#2011
I've mentioned in that issue, that there could be a self contained "core" library without any external bindings, it would request all the needed data by some kind of abstract async api. That way we could port it more easily to other platforms like WASM (nodejs file io or even the browser).
The text was updated successfully, but these errors were encountered: