Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Nx errs on the side of caution when using inputs. Ideally, the "perfect" configu

For an overview of all the possible [types of inputs](/docs/reference/inputs) and how to reuse sets of inputs as [named inputs](/docs/reference/inputs#named-inputs), see the reference documentation.

{% aside type="caution" title="Directory Paths Require Trailing Slash or Glob" %}
When specifying a directory as an input, you must use a trailing slash (`/`) or a glob pattern. For example, `{projectRoot}/src/` or `{projectRoot}/src/**/*` will match all files in the `src` directory, but `{projectRoot}/src` (without trailing slash) will not match any files. This differs from `outputs`, which support naked directory paths.
{% /aside %}

Throughout this recipe, the following project structure of a simple workspace will be used as an example to help understand inputs better.

{% graph height="450px" %}
Expand Down
19 changes: 19 additions & 0 deletions astro-docs/src/content/docs/reference/inputs.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ Source file inputs are defined like this:

Source file inputs must be prefixed with either `{projectRoot}` or `{workspaceRoot}` to distinguish where the paths should be resolved from. `{workspaceRoot}` should only appear in the beginning of an input but `{projectRoot}` and `{projectName}` can be specified later in the input to interpolate the root or name of the project into the input location.

#### Directory Paths

When specifying a directory as an input, you must use a trailing slash or a glob pattern. A path without a trailing slash or glob pattern will be treated as a file path and will not match any files within the directory.

```jsonc
// nx.json
{
"inputs": [
"{projectRoot}/src/", // ✓ Matches all files in src (note the trailing slash)
"{projectRoot}/src/**/*", // ✓ Matches all files in src using glob
"{projectRoot}/src" // ✗ Does NOT match files - treated as a file path
]
}
```

{% aside type="note" title="Difference from Outputs" %}
This behavior differs from `outputs`, which support naked directory paths without a trailing slash. For example, `{projectRoot}/dist` works as an output but would not work as an input.
{% /aside %}

#### Token Behavior with Nested Projects

These tokens behave differently when dealing with nested projects:
Expand Down