checkForPartials method
writes the partials
to the content
Implementation
@visibleForTesting
ContentReplacement checkForPartials({
required String content,
required Iterable<Partial> partials,
}) {
var newContent = content;
final partialsUsed = <String>{};
for (final partial in partials) {
final partialPattern =
RegExp(r'.*\bpartials\.' '${partial.name}' r'\b.*');
final compareContent = newContent;
newContent =
newContent.replaceAll(partialPattern, partial.toPartialInput());
if (compareContent != newContent) {
partialsUsed.add(partial.fileName);
}
}
return ContentReplacement(content: newContent, used: partialsUsed);
}