# Compile

You would use the Hardhat as usual. Client classes will be generated for the compiled contracts automatically

```
npx hardhat compile
```

#### Additional CLI parameters

### `--sources`&#x20;

Override the default sources folder (`/contracts`)

```
npx hardhat compile --sources /other/folder/in/projects/root
```

***

### `--artifacts`&#x20;

Override the default output folder

```
npx hardhat compile --artifacts /foo/bar
```

***

### `--watch true`&#x20;

Compile the contracts, watch `*.sol` files for changes and automatically recompile

```
npx hardhat compile --watch true
```

***

### `--package`

Enables the mono-repo structure for the project. The contracts can now be organized into separate package folders within the repository

```

project/
├─ packages/
│  ├─ Foo/
│  │  ├─ contracts/
│  │  │  ├─ Foo.sol
│  ├─ Bar/
│  │  ├─ contracts/
│  │  │  ├─ Bar.sol
```

Every package can be implemented separately, but still **reference the contracts and interfaces** of each other. To compile the package:

```
npx hardhat compile --package packages/Bar
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0xweb.org/hardhat/compile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
