26 lines
960 B
Markdown
26 lines
960 B
Markdown
# 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
|
|
let mut routes = RocketRouteGenerator::new();
|
|
routes.add(RocketRoute {
|
|
source: browserify("foo.js"),
|
|
mountpoint: String::from("/foo.js"),
|
|
content_type: "JavaScript"
|
|
});
|
|
|
|
let mut templates = HandlebarsGenerator::new();
|
|
templates.add(HandlebarsTemplate {
|
|
source: PathBuf::from("templates/foo.hbs"),
|
|
name: "foo"
|
|
});
|
|
|
|
let mut writer = ResourceWriter::new();
|
|
writer.add_resources(routes);
|
|
writer.add_resources(templates);
|
|
writer.write("resources.rs");
|