Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an option for loading the runtime config #9

Merged
merged 1 commit into from
Sep 21, 2021
Merged
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
13 changes: 11 additions & 2 deletions lib/mix/tasks/sass.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ defmodule Mix.Tasks.Sass do
If dart-sass is not installed, it is automatically downloaded.
Note the arguments given to this task will be appended
to any configured arguments.

## Options
* `--runtime-config` - load the runtime configuration before executing
command
"""

@shortdoc "Invokes sass with the profile and args"
Expand All @@ -25,11 +29,16 @@ defmodule Mix.Tasks.Sass do

@impl true
def run([profile | args] = all) do
if Code.ensure_loaded?(Mix.Tasks.App.Config) do
switches = [runtime_config: :boolean]
{opts, remaining_args} = OptionParser.parse_head!(args, switches: switches)

if opts[:runtime_config] do
Mix.Task.run("app.config")
else
Application.ensure_all_started(:dart_sass)
end

case DartSass.install_and_run(String.to_atom(profile), args) do
case DartSass.install_and_run(String.to_atom(profile), remaining_args) do
0 -> :ok
status -> Mix.raise("`mix sass #{Enum.join(all, " ")}` exited with #{status}")
end
Expand Down