Comments (6)
If excluding folders gets allowed, what about individual (big) files, and what about globs? 🤔
Also, it would make sense to also use the shell-expand feature on the exclusion paths.
from rust-embed.
I'm looking for something that's mostly similar, but I have need for something more granular. Basically there are two issues for us:
- We have a master repo with several Rocket projects in it. These Rocket projects use a shared "htstatic" directory in the tree which contains
img
,css
andjs
with their respective files. Some files within are used by all Rocket applications, some are not. Currently rust-embed will add all files to all Rocket projects, unless we split the htstatic directory up, which we really don't want to do. - For debug builds we have our
foo.js
and ourfoo.css
with all its bells and whistles, but for the release builds we want to use "minified" versions of them. Our build system builds these intofoo.min.js
andfoo.min.css
, and in the final binary we want to include the ".min." versions, but not the originals.
In our case it would be really useful if:
The debug build just publishes everything, as it currently does.
But for the release build there should be a way to either exclude some entries or to explicitly state what should be included. In our case we'd prefer to have something like:
#[folder = "../../libs/htstatic/", include_manifest = "release_files"]
.. and release_files
would be a file of file/directory entries that should be included in the list for release builds.
The upside of being able to specify an external manifest file, rather than adding the entries to the source code, is that build systems can generate these lists as appropriate for the platform it is building on.
Also, I'd like to voice some concerns about using .gitignore
as an exclude list: Not everyone uses git, and not all projects live in the root of a repository. Please pick a name which is agnotic to the source management system.
from rust-embed.
I think having the ability to exclude multiple folders would be enough for the moment. Having rust-embed follow .gitignore would probably cause more harm than good, since most projects git ignore the output of module bundlers like webpack but need those folders for the Rust code to work.
from rust-embed.
@NfNitLoop I'm glad rust-embed is useful to you. Yes the exclude folder would be needed in this case. Ignoring folders in .gitignore might be harder to implement for now.
Anyone else here has any thoughts/ideas on how this should be done?
#[derive(RustEmbed)]
#[folder = "examples/", exclude = "big_dir"]
from rust-embed.
In order to exclude multiple folders, it may need to look like this:
#[derive(RustEmbed)]
#[folder = "examples/", exclude("big_dir1", "big_dir2")]
from rust-embed.
This is implemented and released in v6.1.0. Thanks to @mbme.
from rust-embed.
Related Issues (20)
- Fails cross-compiled and run under Wine in debug mode. HOT 1
- Depending on wrong version of `walkdir`. HOT 1
- Bump `syn` ^2 HOT 1
- The `mime-guess` feature doesn't work HOT 4
- using with askama compile time templates HOT 3
- Fix compression with interpolated env HOT 2
- Clarify MSRV policy HOT 7
- error[E0609]: no field `data` on type `Cow<'_, [u8]>` HOT 1
- Is there a way to include files based on an externally generated list HOT 6
- Rename RustEmbed trait to Embed? HOT 5
- Axum 0.7.1 - no function or associated item named `get` found for struct `Asset` in the current scope HOT 1
- Is there a way to encrypt embedded file? Maybe before/after hooks? HOT 10
- A feature analogous to debug-embed, but for WASM? HOT 2
- Debug builds more lenient when loading relative paths
- `RustEmbed` derive macro is susceptible to naming collisions HOT 2
- rust-embed is tainted with MPL-2 via option-ext HOT 1
- low compilation performance when embeding large folder even though having excludes. HOT 1
- Unable to read symbolic link in debug mode HOT 4
- Replace / expand `prefix` to allow using a generic function for rewriting paths HOT 2
- Option to not include file contents 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 rust-embed.