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 mut scope = Scope::new();
|
||||||
let path = name.as_ref().to_path_buf();
|
let path = name.as_ref().to_path_buf();
|
||||||
let name = path.file_name().unwrap();
|
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")
|
todo!("handle css imports")
|
||||||
}
|
}
|
||||||
let mut p1 = path.clone();
|
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());
|
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();
|
let Token { kind, pos } = self.lexer.next().unwrap();
|
||||||
if kind != TokenKind::Symbol(Symbol::SemiColon) {
|
if kind != TokenKind::Symbol(Symbol::SemiColon) {
|
||||||
@ -685,14 +685,15 @@ impl<'a> StyleSheetParser<'a> {
|
|||||||
|
|
||||||
fn main() -> SassResult<()> {
|
fn main() -> SassResult<()> {
|
||||||
let mut stdout = std::io::BufWriter::new(std::io::stdout());
|
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);
|
// dbg!(s);
|
||||||
// s.pretty_print(&mut stdout)?;
|
// s.pretty_print(&mut stdout)?;
|
||||||
// s.pretty_print_selectors(&mut stdout)?;
|
// s.pretty_print_selectors(&mut stdout)?;
|
||||||
s.print_as_css(&mut stdout)?;
|
|
||||||
// dbg!(Css::from_stylesheet(s));
|
|
||||||
// println!("{}", s);
|
|
||||||
// drop(input);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user