forge-flatten - Flatten a source file and all of its imports into one file.
forge flatten
[options] file
Flatten a source file and all of its imports into one file.
If --output <FILE>
is not set, then the flattened contract will be output to stdout.
-o
file
--output
file
The path to output the flattened contract. If not specified, the flattened contract will be output to stdout.
{{#include project-options.md}}
{{#include common-options.md}}
-
Flatten
src/Contract.sol
:forge flatten src/Contract.sol
-
Flatten
src/Contract.sol
and write the result tosrc/Contract.flattened.sol
:forge flatten --output src/Contract.flattened.sol src/Contract.sol