Coder Social home page Coder Social logo

Comments (6)

Boscop avatar Boscop commented on May 22, 2024 2

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.

qrnch-jan avatar qrnch-jan commented on May 22, 2024 2

I'm looking for something that's mostly similar, but I have need for something more granular. Basically there are two issues for us:

  1. 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 and js 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.
  2. For debug builds we have our foo.js and our foo.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 into foo.min.js and foo.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.

paolobarbolini avatar paolobarbolini commented on May 22, 2024 1

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.

pyrossh avatar pyrossh commented on May 22, 2024

@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.

AzureMarker avatar AzureMarker commented on May 22, 2024

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.

pyrossh avatar pyrossh commented on May 22, 2024

This is implemented and released in v6.1.0. Thanks to @mbme.

from rust-embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.