gruntjs / gruntjs/grunt

Enable access to the default options of a task in the configurations of another task

Open
#1,237 0 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

I did not find any explicit documentation regarding this.

Doesn't it makes sense to be able to access the merged defaults from another task configuration?

Use case:

``` javascript
servers: {
wildfly: {
options: {
// This value is assumed default, not specified
// preset: "wildfly-8.1.0.Final"
}
}
},
qunit: {
wildfly: {
options: {
urls: [
// In this case it doesn't work, because "servers.wildfly.options.preset" is not available
"http://localhost/<%= servers.wildfly.options.preset %>/index.html"
]
}
}
}
```

In my task I am using the following code:

``` javascript
var defaults = {
preset: "wildfly-8.1.0.Final"
};
grunt.registerMultiTask( "servers", function() {
var options = this.options( defaults );
// ... task behavior here
});
```

It is expected that "preset" is available outside the task into the developer's configuration, but it currently doesn't.

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.