Comments (2)
You could use rust-embed (or includedir or include_dir), or tar/zip your files in your build script and embed with include_bytes!
, then traverse/unpack at runtime.
Then you set up the routing of your web server (e.g. actix-web) to resolve to the embedded files. If using rust-embed you call get(path)
on the generated struct. You could use mime_guess to set the content type.
It's probably only worth doing this for release builds since include_*
macros can significantly increase compile times. AFAIK that's a compiler bug that may be fixed but for now I'm not sure there's much you can do apart from appending the files to the binary somehow.
from web-view.
Depending on how many resources you have, you may be able to get away with just inlining them manually. In my case I could just use base64 data URIs and include_str!
the HTML file. But if you require a build step for your JS, @green-s's option sounds great.
from web-view.
Related Issues (20)
- How to load url?
- Facilitate using step() while processing other events
- alert(), confirm(), and console.log() extremely slow and distorted on Ubuntu 20.04 HOT 1
- Way to get current URL?
- Debug mode dumps HTML on every console message HOT 1
- Is there a ready event?
- Is this browser ready?
- Is there a way to access the true file system path when using a "Browse" button on webview?
- [Solved] Compilation fails with Edge feature enabled HOT 1
- Hovering over an image for alt text causes `NSException` on macOS 12.1 w/ M1
- Is multitouch supported? HOT 1
- Android? iOS?
- Make a fork and cooperate to maintain this crate! HOT 1
- box-shadow wrongly displayed
- iframe support?
- Corrupted files
- Is there a way to open two webview windows without crashing? HOT 1
- external.invoke returns undefined instead of promise on Windows 10 HOT 1
- Rust Webview JavaScript interface
- how to create handler? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-view.