Skip to content

The library to help automate static resource collection

License

Unlicense and 2 other licenses found

Licenses found

Unlicense
UNLICENSE
Unknown
COPYING
MIT
MIT-LICENSE
Notifications You must be signed in to change notification settings

static-files-rs/static-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

static-files - the library to help automate static resource collection

Legal

Dual-licensed under MIT or the UNLICENSE.

Features

  • Embed static resources in executuble
  • Install dependencies with npm package manager
  • Run custom npm run commands (such as webpack)
  • Support for npm-like package managers (yarn)
  • Change detection support to reduce compilation time

Usage

Create folder with static resources in your project (for example static):

cd project_dir
mkdir static
echo "Hello, world" > static/hello

Add to Cargo.toml dependency to static-files:

[dependencies]
static-files = "0.2"

[build-dependencies]
static-files = "0.2"

Add build.rs with call to bundle resources:

use static_files::resource_dir;

fn main() -> std::io::Result<()> {
    resource_dir("./static").build()
}

Include generated code in main.rs:

include!(concat!(env!("OUT_DIR"), "/generated.rs"));

fn main() -> std::io::Result<()> {
    let generated = generate(); // <-- this function is defined in generated.rs
    // ...
    Ok(())
}

About

The library to help automate static resource collection

Resources

License

Unlicense and 2 other licenses found

Licenses found

Unlicense
UNLICENSE
Unknown
COPYING
MIT
MIT-LICENSE

Stars

Watchers

Forks

Packages

No packages published