Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Use require-dir to pull in tasks automatically #14

Merged
merged 1 commit into from
Nov 10, 2014
Merged

Conversation

baer
Copy link
Collaborator

@baer baer commented Nov 6, 2014

Addresses #7

This PR aligns the project with the "blessed" way to require tasks as per the Gulp project. Two things had to happen for this to work:

  1. Use require-dir to auto require any task placed under tasks.
  2. Removes the export syntax from the task files.

NOTE: This PR is best viewed without whitespace changes. Use the query param ?w=1 to do that.

@baer
Copy link
Collaborator Author

baer commented Nov 6, 2014

In the process of doing this I found 2 errors:

  1. config wasn't being used in karma
  2. the tasks that required webpack.dev.config were using the name webpackConfig

@divmain
Copy link
Owner

divmain commented Nov 7, 2014

Looks like requireDir supports recursive imports:
https://github.com/aseemk/requireDir#options

@baer
Copy link
Collaborator Author

baer commented Nov 10, 2014

Good catch - I just tried globs and assumed :)

Fixed

require("./tasks/frontend/build-js-dev")(gulp, webpackDevConfig);
require("./tasks/frontend/test-browser")(gulp, config, webpackDevConfig);
require("./tasks/frontend/test-karma")(gulp, config, karmaConfig);
requireDir("./tasks", {recurse: true});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requireDir is undefined.

@divmain
Copy link
Owner

divmain commented Nov 10, 2014

Once everything passes gulp lint and normal tasks seem to work as expected, feel free to merge!

baer added a commit that referenced this pull request Nov 10, 2014
Use require-dir to pull in tasks automatically
@baer baer merged commit 40c8c07 into master Nov 10, 2014
@baer baer deleted the feature/require-dir branch November 10, 2014 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants