Parse files given path from stdin
This commit is contained in:
parent
0d9d1fc234
commit
f3d21f1677
@ -7,7 +7,8 @@ pub fn import<P: AsRef<Path>>(name: P) -> (Vec<Stmt>, 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();
|
||||
|
13
src/main.rs
13
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(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user