fixed formatting
This commit is contained in:
parent
fe26350932
commit
afbae12b72
@ -250,11 +250,10 @@ pub fn from_string(p: String) -> std::result::Result<String, JsValue> {
|
||||
.map_err(|e| raw_to_parse_error(&map, *e).to_string())?)
|
||||
}
|
||||
|
||||
|
||||
#[cfg_attr(feature = "profiling", inline(never))]
|
||||
#[cfg_attr(not(feature = "profiling"), inline)]
|
||||
#[cfg(not(feature = "wasm"))]
|
||||
pub fn from_path_with_load_paths(p: &str, loadpaths: Vec<&Path>) -> Result<String> {
|
||||
pub fn from_path_with_load_paths(p: &str, loadpaths: &Vec<&Path>) -> Result<String> {
|
||||
let mut map = CodeMap::new();
|
||||
let file = map.add_file(p.into(), String::from_utf8(fs::read(p)?)?);
|
||||
let empty_span = file.span.subspan(0, 0);
|
||||
@ -276,7 +275,7 @@ pub fn from_path_with_load_paths(p: &str, loadpaths: Vec<&Path>) -> Result<Strin
|
||||
at_root_has_selector: false,
|
||||
extender: &mut Extender::new(empty_span),
|
||||
content_scopes: &mut Scopes::new(),
|
||||
load_paths: &loadpaths,
|
||||
load_paths: loadpaths,
|
||||
}
|
||||
.parse()
|
||||
.map_err(|e| raw_to_parse_error(&map, *e))?;
|
||||
@ -285,4 +284,4 @@ pub fn from_path_with_load_paths(p: &str, loadpaths: Vec<&Path>) -> Result<Strin
|
||||
.map_err(|e| raw_to_parse_error(&map, *e))?
|
||||
.pretty_print(&map)
|
||||
.map_err(|e| raw_to_parse_error(&map, *e))
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ fn main() -> std::io::Result<()> {
|
||||
if let Some(path) = matches.value_of("OUTPUT") {
|
||||
let mut buf = BufWriter::new(File::open(path).unwrap_or(File::create(path)?));
|
||||
buf.write_all(
|
||||
from_path_with_load_paths(name, vals)
|
||||
from_path_with_load_paths(name, &vals)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
std::process::exit(1)
|
||||
@ -203,7 +203,7 @@ fn main() -> std::io::Result<()> {
|
||||
} else {
|
||||
let mut stdout = BufWriter::new(stdout());
|
||||
stdout.write_all(
|
||||
from_path_with_load_paths(name, vals)
|
||||
from_path_with_load_paths(name, &vals)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
std::process::exit(1)
|
||||
|
@ -107,7 +107,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse()?;
|
||||
|
||||
|
@ -97,24 +97,23 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
for _path in self.load_paths {
|
||||
for path in self.load_paths {
|
||||
let paths;
|
||||
if _path.is_dir() {
|
||||
if path.is_dir() {
|
||||
paths = vec![
|
||||
_path.join(format!("{}.scss", name.to_str().unwrap())),
|
||||
_path.join(format!("_{}.scss", name.to_str().unwrap())),
|
||||
_path.join("index.scss"),
|
||||
_path.join("_index.scss"),
|
||||
path.join(format!("{}.scss", name.to_str().unwrap())),
|
||||
path.join(format!("_{}.scss", name.to_str().unwrap())),
|
||||
path.join("index.scss"),
|
||||
path.join("_index.scss"),
|
||||
];
|
||||
} else {
|
||||
paths = vec![
|
||||
_path.to_path_buf(),
|
||||
_path.with_file_name(name).with_extension("scss"),
|
||||
_path
|
||||
.with_file_name(format!("_{}", name.to_str().unwrap()))
|
||||
path.to_path_buf(),
|
||||
path.with_file_name(name).with_extension("scss"),
|
||||
path.with_file_name(format!("_{}", name.to_str().unwrap()))
|
||||
.with_extension("scss"),
|
||||
_path.join("index.scss"),
|
||||
_path.join("_index.scss"),
|
||||
path.join("index.scss"),
|
||||
path.join("_index.scss"),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
})
|
||||
.parse_keyframes_selector()?;
|
||||
|
||||
@ -196,7 +196,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse_stmt()?;
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse()?;
|
||||
|
||||
@ -206,7 +206,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse()?
|
||||
} else {
|
||||
|
@ -361,7 +361,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
},
|
||||
allows_parent,
|
||||
true,
|
||||
@ -600,7 +600,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse_stmt()?;
|
||||
|
||||
@ -668,7 +668,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse()?
|
||||
.into_iter()
|
||||
@ -709,7 +709,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse_selector(false, true, String::new())?;
|
||||
|
||||
@ -787,7 +787,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse_stmt()?;
|
||||
|
||||
|
@ -201,7 +201,7 @@ impl<'a> Parser<'a> {
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
load_paths: self.load_paths
|
||||
load_paths: self.load_paths,
|
||||
}
|
||||
.parse_value(in_paren)
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ impl Value {
|
||||
at_root_has_selector: parser.at_root_has_selector,
|
||||
extender: parser.extender,
|
||||
content_scopes: parser.content_scopes,
|
||||
load_paths: parser.load_paths
|
||||
load_paths: parser.load_paths,
|
||||
}
|
||||
.parse_selector(allows_parent, true, String::new())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user