From f3d21f1677be98fac1c6ae53550c15394c311140 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 18 Jan 2020 18:12:53 -0500 Subject: [PATCH] Parse files given path from stdin --- src/imports.rs | 3 ++- src/main.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/imports.rs b/src/imports.rs index 194fa91..a13e2ef 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -7,7 +7,8 @@ pub fn import>(name: P) -> (Vec, Scope) { let mut scope = Scope::new(); let path = name.as_ref().to_path_buf(); let name = path.file_name().unwrap(); - if path.extension() == Some(std::ffi::OsStr::new(".css")) {// || name.starts_with("http://") || name.starts_with("https://") { + if path.extension() == Some(std::ffi::OsStr::new(".css")) { + // || name.starts_with("http://") || name.starts_with("https://") { todo!("handle css imports") } let mut p1 = path.clone(); diff --git a/src/main.rs b/src/main.rs index 9e3c400..5303787 100644 --- a/src/main.rs +++ b/src/main.rs @@ -309,7 +309,7 @@ impl<'a> StyleSheetParser<'a> { file_name.push_str(&tok.kind.to_string()); } } - _ => todo!("expected ' or \" after @import") + _ => todo!("expected ' or \" after @import"), } let Token { kind, pos } = self.lexer.next().unwrap(); if kind != TokenKind::Symbol(Symbol::SemiColon) { @@ -685,14 +685,15 @@ impl<'a> StyleSheetParser<'a> { fn main() -> SassResult<()> { let mut stdout = std::io::BufWriter::new(std::io::stdout()); - let s = StyleSheet::from_path("input.scss")?; + let mut args = std::env::args(); + args.next(); + for arg in args { + let s = StyleSheet::from_path(arg)?; + s.print_as_css(&mut stdout)?; + } // dbg!(s); // s.pretty_print(&mut stdout)?; // s.pretty_print_selectors(&mut stdout)?; - s.print_as_css(&mut stdout)?; - // dbg!(Css::from_stylesheet(s)); - // println!("{}", s); - // drop(input); Ok(()) }