gruntjs / gruntjs/grunt

Why is config expansion disallowed for multitask configuration

Open
#1,215 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 wished to use the same configuration across multiple tasks (each of which is a 'multitask'.) My initial approach was to declare a variable in the gruntfile that I pointed each GruntFile's configuration key for those tasks at.

```
var servers= { one: {}, two: {}, three: {} }
var gruntConfig= {
start_servers= servers,
stop_servers= servers
};
```

This worked fine.

However I then wanted to specify that value (the multitask configuration) as a property in the grunt config that contained template properties, specifically the whole config was a template.

```
var gruntConfig= {
servers = { one: {}, two: {}, three: {} }
start_servers= <%=servers%>,
stop_servers= <%=servers%>
};
```

I can see from:

https://github.com/gruntjs/grunt/commit/bc9905c79c3022dc0b4e6ab88009f6680aa81ef6

it was a deliberate change to not support this functionality, but I was wondering why,and if there was a way I could still do this ? :)

Contributor guide

Open the contributing guide

Research direction

Start by reading commit bc9905c79c3022dc0b4e6ab88009f6680aa81ef6 and the Gruntfile multitask configuration described in the issue. Compare direct object references with template-expanded configuration values. Done means documenting the rationale for the restriction and determining whether a supported way exists to share this configuration across tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.