scan_content() — tailwindcss Function Reference
Architecture documentation for the scan_content() function in mod.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 73312877_857d_41ca_363e_e2e1b899efb0["scan_content()"] d865d4fd_bb15_6d9a_a900_10e82a6856fb["mod.rs"] 73312877_857d_41ca_363e_e2e1b899efb0 -->|defined in| d865d4fd_bb15_6d9a_a900_10e82a6856fb 71d580ee_7b1d_18a6_7e10_fcd29d80bbb7["extract_candidates()"] 73312877_857d_41ca_363e_e2e1b899efb0 -->|calls| 71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 style 73312877_857d_41ca_363e_e2e1b899efb0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/scanner/mod.rs lines 200–278
pub fn scan_content(&mut self, changed_content: Vec<ChangedContent>) -> Vec<String> {
let (changed_files, changed_contents) =
changed_content
.into_iter()
.partition::<Vec<_>, _>(|x| match x {
ChangedContent::File(_, _) => true,
ChangedContent::Content(_, _) => false,
});
// Raw content can be parsed directly, no need to verify if the file exists and is allowed
// to be scanned.
self.changed_content.extend(changed_contents);
// Fully resolve all files
let changed_files = changed_files
.into_iter()
.filter_map(|changed_content| match changed_content {
ChangedContent::File(file, extension) => {
let Ok(file) = dunce::canonicalize(file) else {
return None;
};
Some(ChangedContent::File(file, extension))
}
_ => unreachable!(),
})
.collect::<Vec<_>>();
let (known_files, mut new_unknown_files) = changed_files
.into_iter()
.partition::<Vec<_>, _>(|changed_file| match changed_file {
ChangedContent::Content(_, _) => unreachable!(),
ChangedContent::File(file, _) => self.files.contains(file),
});
// All known files are allowed to be scanned
self.changed_content.extend(known_files);
// Figure out if the new unknown files are allowed to be scanned
if !new_unknown_files.is_empty() {
if let Some(walk_builder) = &mut self.walker {
for entry in walk_builder.build().filter_map(Result::ok) {
let path = entry.path();
if !path.is_file() {
continue;
}
let mut drop_file_indexes = vec![];
for (idx, changed_file) in new_unknown_files.iter().enumerate().rev() {
let ChangedContent::File(file, _) = changed_file else {
continue;
};
// When the file is found on disk it means that all the rules pass. We can
// extract the current file and remove it from the list of passed in files.
if file == path {
self.files.push(path.to_path_buf()); // Track for future use
self.changed_content.push(changed_file.clone()); // Track for parsing
drop_file_indexes.push(idx);
}
}
// Remove all files that we found on disk
if !drop_file_indexes.is_empty() {
drop_file_indexes.into_iter().for_each(|idx| {
new_unknown_files.remove(idx);
});
}
// We can stop walking the file system if all files we are interested in have
// been found.
if new_unknown_files.is_empty() {
break;
}
}
}
}
self.extract_candidates()
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does scan_content() do?
scan_content() is a function in the tailwindcss codebase, defined in crates/oxide/src/scanner/mod.rs.
Where is scan_content() defined?
scan_content() is defined in crates/oxide/src/scanner/mod.rs at line 200.
What does scan_content() call?
scan_content() calls 1 function(s): extract_candidates.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free