stawege_js_plugin/
js_plugin.rs1use core::error::Error;
2use std::{
3 fs::File,
4 io::{Read, Write},
5};
6
7use stawege_plugin::Plugin;
8
9#[derive(Debug, Default, Clone, Copy)]
10pub struct JsPlugin {}
11
12impl JsPlugin {
13 pub fn new() -> Self {
14 Self {}
15 }
16}
17
18impl Plugin for JsPlugin {
23 fn extensions(&self) -> &[&str] {
24 &["js"]
25 }
26
27 fn process_file_to(
28 &mut self,
29 mut source_file: File,
30 mut output_file: File,
31 ) -> Result<(), Box<dyn Error>> {
32 let mut content = String::new();
33 source_file.read_to_string(&mut content)?;
34 output_file.write_all(content.as_bytes())?;
35 Ok(())
36 }
37}