docs: update docs on source code vs values

This commit is contained in:
Zach Daniel 2024-08-13 16:09:52 -04:00
parent 14552bcef9
commit 927f0d4ae3

View file

@ -8,6 +8,8 @@ defmodule Igniter.Project.Config do
@doc """
Sets a config value in the given configuration file, if it is not already set.
See `configure/6` for more.
## Opts
* `failure_message` - A message to display to the user if the configuration change is unsuccessful.
@ -28,6 +30,22 @@ defmodule Igniter.Project.Config do
@doc """
Sets a config value in the given configuration file, updating it with `updater` if it is already set.
If the value is source code, pass `{:code, value}`, otherwise pass just the value.
To produce this source code, we suggest using `Sourceror.parse_string!`. For example:
```elixir
|> Igniter.Project.Config.configure(
"fake.exs",
:tailwind,
[:default, :args],
{:code,
Sourceror.parse_string!(\"\"\"
~w(--config=tailwind.config.js --input=css/app.css --output=../output/assets/app.css)
\"\"\")}
)
```
## Opts
* `:updater` - A function that takes a zipper at a currently configured value and returns a new zipper with the value updated.