From 927f0d4ae30be3d50810890cb983e34a3d2a9b54 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Tue, 13 Aug 2024 16:09:52 -0400 Subject: [PATCH] docs: update docs on source code vs values --- lib/igniter/project/config.ex | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/igniter/project/config.ex b/lib/igniter/project/config.ex index bfeb1a4..c22815b 100644 --- a/lib/igniter/project/config.ex +++ b/lib/igniter/project/config.ex @@ -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.