gruntjs / gruntjs/gruntjs.com

It should be clarified that Files should be declared within targets

Open
#238 0 comments 0 reactions 0 assignees View on GitHub
content: Documentation section
Dominant language
Less
Stars
155
Forks
83
PR merge metrics
No merged PRs in 30d

Description

I couldn't figure out why the `files` settings I was trying to use with Uglify were seemingly ignored. Then, I read the following from [this Gist](https://gist.github.com/jonschlinkert/9ffb288606727d4ef7f2):

> ... generally defining files at the task-level is bad practice, and often won't work ...

What the heck?

The [Configuring Tasks](https://gruntjs.com/configuring-tasks) page suggests that you _can_ (not that you _must_) have multiple targets for multi-tasks.

> Multi-tasks can have multiple configurations, defined using arbitrarily named "targets."

And [Sample Gruntfile](https://gruntjs.com/sample-gruntfile) even shows usage of `files` directly beneath a task:

```
...
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
....
```

I can't find anywhere in the Grunt or Uglify documentation that `files` should be declared within a target. Targets are, as far as I can tell from the documentation, totally optional. Therefore, I would have no expectation that my gruntfile was working unexpectedly because I didn't wrap `files` within a target.

I think it would be really helpful to clarify this fact (prominently) in the documentation; or maybe even add a Best Practices page.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.