# Global Taskfile: ~/Taskfile.yaml
version: "3"
dotenv:
- "{{.USER_WORKING_DIR}}/.env" # <<<< Does not work (but it should)
# - "~/repos/my-project/.env" # <<<< Works
tasks:
build:
dir: '{{.USER_WORKING_DIR}}'
dotenv: ["{{.USER_WORKING_DIR}}/.env"] # <<<< Does not load Taskfile Variable either but it does load env variable
cmds:
# Should print: "value = testABC123"
- echo value = {{.DOT_ENV_VAR}}
And .env file:
# Local .env file: ~/repos/my-project/.env
DOT_ENV_VAR=testABC123
With this Taskfile:
And
.env
file:Then running this:
Should print:
But prints:
This is not a blocker as we can still use script variables (instead of Taskfile variables):
But it is not ideal as it prints:
We would like to see task output with variable values replaced in the script like below:
Task Version Output: