Crate nya[−][src]
nya
is a simple file processor. It's extremely simple, very fast, and super
cute, as well. It reads files from a directory, does stuff to them, and then
spits them out somewhere else. That's all it does. The "stuff" that's being
done to the files is called middleware. Middleware is just a function that
takes a struct representing a file and then does something to that file.
It doesn't even have to return it! That's how easy it is to use nya
. Can
you believe it?
In its simplest form, you'd use it somewhat like this:
extern crate nya; use nya::create_middleware; fn main() { nya::run(vec![ create_middleware(|files| { let file = &mut files[0]; file.content = "test hello".to_string(); }) ], Some("fixtures/example"), Some("_site")).unwrap(); }
How does nya
compare to other software?
At some distant point in time, I'd like for nya
to be used as a static site
generator. How would it compare to other existing static site generators, then?
Well, it's much simpler than Jekyll or Hugo, for example, and it's even
simpler than other JavaScript-based SSGs such as Metalsmith or Wintersmith.
Existing Rust SSGs have all more or less tried to replicate the full feature set
of Jekyll or comparable software, so I hope I'll be scratching an itch here.
nya
currently only depends on walkdir
, and I'd like to keep dependencies
as light as possible.
Structs
SimpleFile |
A struct describing a simple file, with only a name, content, and its path. |
Functions
create_middleware |
A convenience function that creates middleware. |
run |
Runs a middleware chain. |