Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn getStr() -> String {
- fs::copy("../client/src/elm/Main.elm",
- "../client/src/elm/Main.elm.bak")
- .expect("file not copied");
- let stdout: Vec<u8>;
- {
- let mut main_file = OpenOptions::new()
- .append(true)
- .open("../client/src/elm/Main.elm")
- .expect("file not opened");
- let str1 = format!(r#"
- view : Html Msg
- view =
- viewWithModel <|
- Model [] HomeRoute <|
- Flags "" {time} ""
- "#,
- time = time::get_time().sec);
- main_file
- .write(str1.as_bytes())
- .expect("file content not saved");
- stdout = Command::new("node")
- .current_dir(&Path::new("../client"))
- .arg("./node_modules/elm-static-html/index.js")
- .arg("-f")
- .arg("src/elm/Main.elm")
- .output()
- .expect("elm-static-html command failed to start")
- .stdout;
- }
- fs::rename("../client/src/elm/Main.elm.bak",
- "../client/src/elm/Main.elm")
- .expect("file not renamed");
- String::from_utf8_lossy(&*stdout)
- .lines()
- .skip_while(|x| {
- // x.d;
- x.find("class \"content\"").is_none()
- })
- .collect()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement