gruntjs / gruntjs/grunt

config.get('foo.bar.baz') does not process intermediate templates in path

Open
#1,436 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

When getting a config "path" (passing e.g. `"foo.bar.baz"` or `['foo', 'bar', 'baz']` to `grunt.config.get`) grunt doesn't process templates as it's stepping through the object graph.

``` js
grunt.initConfig({
getFooBarBaz: '<%= foo.bar.baz %>',
foo: '<%= _foo %>',
_foo: {
bar: '<%= _bar %>'
},
_bar: {
baz: 123
}
});
grunt.config('foo');
// returns { bar: { baz: 123 } }

grunt.config('foo.bar.baz');
grunt.config('getFooBarBaz')
// Both return { bar: { baz: 123 } } but I expected 123
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the grunt.initConfig and grunt.config examples in the report, then trace how grunt.config resolves dotted and array paths. Done means intermediate templates are processed while traversing the object graph so both reported lookups return 123, with coverage for the shown cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.