26 lines
960 B
Markdown
Raw Permalink Normal View History

2017-10-26 02:38:08 -05:00
# TODO
Make an API that actually makes sense. I'm thinking something along the lines of:
* ResourceGenerator, which accepts an input (always a file, static byte or character source, etc), and
transforms it into some other representation
* Convenience methods that add a file or an entire directory structure, guessing the content type etc.
* ResourceWriter, which just wraps the Generators and spits out the output file
## Sample
2017-10-26 02:42:35 -05:00
let mut routes = RocketRouteGenerator::new();
routes.add(RocketRoute {
source: browserify("foo.js"),
mountpoint: String::from("/foo.js"),
content_type: "JavaScript"
});
2017-10-26 02:38:08 -05:00
2017-10-26 02:42:35 -05:00
let mut templates = HandlebarsGenerator::new();
templates.add(HandlebarsTemplate {
source: PathBuf::from("templates/foo.hbs"),
name: "foo"
});
2017-10-26 02:38:08 -05:00
2017-10-26 02:42:35 -05:00
let mut writer = ResourceWriter::new();
writer.add_resources(routes);
writer.add_resources(templates);
writer.write("resources.rs");