~fancycade/rebar3_tailwind

711ce645df7cce7dc8ab85f0fd99aae72ee6ad65 — Harley Swick 9 months ago 8dbf3d9
Option lookups
1 files changed, 8 insertions(+), 8 deletions(-)

M src/rebar3_tailwind_prv.erl
M src/rebar3_tailwind_prv.erl => src/rebar3_tailwind_prv.erl +8 -8
@@ 36,8 36,9 @@ do(State) ->

    [begin
	 Opts = rebar_app_info:opts(AppInfo),
	 TailwindOpts = rebar_opts:get(Opts, tailwind_opts, []),
	 CompileFun = fun(_Source, _Opts) ->
			      tailwind_compile(Opts)
			      tailwind_compile(TailwindOpts)
		      end,

	 rebar_base_compiler:run(Opts, [], ["default"], CompileFun)


@@ 49,17 50,16 @@ format_error(Reason) ->
    io_lib:format("~p", [Reason]).

tailwind_compile(Opts) ->
    io:format("~p~n", rebar_opts:get(Opts, tailwind_opts, [])),
    InputSrc = 
	case application:get_env(rebar3_tailwind, input) of
	    {ok, I} -> I;
	    _ -> "priv/input.css"
	case proplists:lookup(input, Opts) of
	    {input, Input} -> Input;
	    none -> "priv/input.css"
	end,
    io:format("~p~n", [InputSrc]),
    OutputDst =
	case application:get_env(rebar3_tailwind, output) of
	    {ok, O} -> O;
	    _ -> "priv/output.css"
	case proplists:lookup(output, Opts) of
	    {output, Output} -> Output;
	    none -> "priv/output.css"
	end,
    io:format("~p~n", [OutputDst]),
    Cmd = io_lib:format("npx tailwindcss -i ~s -o ~s", [InputSrc, OutputDst]),