Comments (3)
That's how it works; it just that the src/static
directory currently only works for bin
crates. (This is a historical artifact as originaly cargo-web
supported only *-emscripten
targets, and there you can only use bin
crates.) Are you perhaps using a lib
or a cdylib
crate?
You can put a static
directory in the root of your crate instead of in src
and that will work for all crate types.
from cargo-web.
Ah, I am in fact using a lib crate, with the lib as the core to my binary. I wonder if there's any way to make that clearer? Or is there some reason that src/static and static/ aren't treated identically, other than that cargo-web used to behave differently? Maybe just combine the contents of all static/ directories into target/deploy/?, or error out if both static/ and src/static/ exist?
I'd be happy to try implementing one or both of these, just want to know which direction you'd like to go in.
from cargo-web.
Well, I think it would make sense to support src/static
for lib crates too now that wasm32-unknown-unknown
can be compiled as a cdylib
crate.
Currently cargo-web
takes static artifacts from two places (in this specific order):
- a target specific
static
directory (forbin
crates this issrc/static
, for examples this isexamples/$example_name-static
) $crate_root/static
- a global directory for all artifacts in your crate (so, binaries, libs, examples, etc.)
If it finds an artifact in the target specific path then it stops looking further. The idea was that if you have multiple things in your crate then you can put the common stuff in static
, and thing-specific stuff in the respective target specific static
directory, and have that "merged" together when running start
or deploy
.
from cargo-web.
Related Issues (20)
- Update Emscripten support HOT 2
- cargo web build ignores dependency features HOT 1
- cargo web start for single page applications
- https support?
- Error when installing
- cargo-web tet fails, no .js file found HOT 5
- Option to include the wasm file content into the generated .js runtime?
- cargo web uses color even when not supported
- cli: expose option use_system_emscripten - and/or allow to use cached download HOT 1
- Cargo panic when running web build HOT 6
- thread 'main' panicked at 'unknown name section chunk type: 7' HOT 13
- cargo web build does not have the default html shell in the build folder
- cargo web start does not correctly serve the sourcemap
- cargo web doesn't serve or deploy Emscripten .data files
- Cash on cargo web build in WSL HOT 1
- Cargo web redownloads emscripten
- error: usage of `--profile` requires `-Z unstable-options`
- Maintenance status HOT 2
- cargo-web 0.6.26 rustc 1.60 [Release flag is ignored] HOT 1
- Installation instruction for precompiled binaries no longer works
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 cargo-web.