Provide a way to add module tasks to Elixir

Description

Currently if you want to add a build task inside a module, you need to specify the tasks directly.

While this is possible, it isn't ideal. This has to be repeated for each build task and each module. For a fully modular application, this creates a lot of boilerplate.

Elixir should have a way to quickly add tasks from modules, preferably with a single command:

This should find the tasks in each module and add them to the current gulp run. Directories should be set correctly. Watch mode should still work.

The files discovered are not quite gulpfiles. They need to be discoverable and runnable. The easiest way to do this is to export the config as a module.

This could then be required in our mix.modules() call and ran with the paths updated correctly.

This file is not quite a gulpfile any more. I propose calling it a elixir-module.js file.

Technically, this could be used in a gulpfile still:

I'm not sure why you would want to run a single module in this way, but it is possible.

Activity

Show:
Jon Clausen
February 15, 2017, 12:10 PM

Now that I look at your code samples, , I think `elixir-module` works fine as the convention name for the file. Especially since the `mix.modules()` function calls it.

Luis Majano
February 16, 2017, 3:42 PM

I am ok with *elixir-module.js*. Few observations though:

1. Ability to do includes, excludes globally

Have the ability to have an *includes & excludes* param in the *modules* mixer

2. Ability to choose 1 or more locations for mixing global modules. By default I am guessing it is looking at *modules_app*

This way you can override the convention of lookup.

3. Ability to mix 1 or more modules a-la-acarte. Just expand the *mix.module()* to expect 1, a list or array of module names

Eric Peterson
February 16, 2017, 5:35 PM

I think those are good suggestions. I think we will stick with arrays over lists, since lists aren't in Elixir (or really much of a thing in JavaScript).

Another thing to add is a way to override the elixir-module.js file name as an optional argument.

Thanks for the feedback!

Fixed

Assignee

Eric Peterson

Reporter

Eric Peterson

Labels

None

Time remaining

0m

Components

Fix versions

Priority

Major
Configure