gruntjs / gruntjs/grunt

Use lodash mixins to supply src file paths

Open
#896 2 comments 0 reactions 0 assignees View on GitHub
Component: tasks Type: Enhancement
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

(this was moved over from https://github.com/gruntjs/grunt/issues/680#issuecomment-24267002, since it was off-topic)

I created this project, [resolve-dep](https://github.com/jonschlinkert/resolve-dep) to make it easy to add the resolved paths to node modules (from dependencies) to the `src` array of file paths. For example, in assemble you could `npm install` a bunch of handlebars helpers, then add the paths to the helpers to the assemble options, like this:

``` js
{
assemble: {
options: {
// _.load() mixin using resolve-dep
helpers: ['<%= _.load("helper-*") %>']
}
}
}
```

The expanded file paths to the helpers would look something like this:

``` js
["node_modules/helper-foo/lib/helper-foo.js", "node_modules/helper-bar/lib/helper-bar.js"]
```

Currently, I believe Grunt calls `toString` on the array of file paths returned by the mixin, so the example I gave above doesn't actually work (it works if you use the mixin to specify one file at a time).

I see use cases for this pretty often, any suggestions on how this can be solved?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.