You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use inline JS snippets today, you need to include the literal directly. However, this only makes sense through code generation where the literal is assembled from another file.
If you're in my position with an extra crate full of snippets, you need to code generate for every module. Using code generation like this is typically not popular in the Rust ecosystem.
Proposed Solution
inline_js (or another label) should support &'static str passed in, allowing for things like include_str! and &str imported from other crates.
We could then structure the _INCLUDED_FILES section to just reference the literal directly, since I don't think there's any validation of the JS snippet code.
Motivation
To use inline JS snippets today, you need to include the literal directly. However, this only makes sense through code generation where the literal is assembled from another file.
If you're in my position with an extra crate full of snippets, you need to code generate for every module. Using code generation like this is typically not popular in the Rust ecosystem.
Proposed Solution
inline_js (or another label) should support
&'static str
passed in, allowing for things likeinclude_str!
and &str imported from other crates.We could then structure the _INCLUDED_FILES section to just reference the literal directly, since I don't think there's any validation of the JS snippet code.
Alternatives
Really the only way to share source JS code between different crates right now is code generation.
The text was updated successfully, but these errors were encountered: