write method

  1. @override
FileWriteResult write({
  1. required Iterable<Partial> partials,
  2. required Set<Variable> outOfFileVariables,
})
override

writes the partial to the target file

Implementation

@override
FileWriteResult write({
  required Iterable<Partial> partials,
  required Set<Variable> outOfFileVariables,
}) {
  try {
    return writeFile(
      targetPath: p.join(outputDir, toPartialFile()),
      sourcePath: sourceFile,
      variables: variables,
      outOfFileVariables: outOfFileVariables,
      partials: partials,
    );
  } catch (e) {
    if (e is ConfigException) {
      throw PartialException(
        partial: sourceFile,
        reason: e.message,
      );
    }

    throw PartialException(
      partial: sourceFile,
      reason: e.toString(),
    );
  }
}