Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Building the files object dynamically' should be array? #66

Open
odigity opened this issue Sep 17, 2013 · 4 comments
Open

'Building the files object dynamically' should be array? #66

odigity opened this issue Sep 17, 2013 · 4 comments

Comments

@odigity
Copy link

odigity commented Sep 17, 2013

(I was going to submit a PR, but after lots of searching I still couldn't figure out where the actual content of the docs was hiding.)

New to Grunt; noticed what I believe to be an error while studying the docs.

The 'Files Object' format is documented here http://gruntjs.com/configuring-tasks#files-object-format, and looks like this:

files: { 'src': 'dest' }

The 'Files Array' format is documented here http://gruntjs.com/configuring-tasks#files-array-format, and looks like this:

files: [
    {src: '...', dest: '...'},
]

Further down, there's a section called 'Building the files object dynamically': http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

However, the example given resembles the Files Array format, not Files Object:

files: [
    {
        expand: true,
        cwd: 'lib/',
        src: ['**/*.js'],
        dest: 'build/',
        ext: '.min.js',
    },
]

Shouldn't the entire section be called 'Building the files array dynamically'?

If so, you will also need to update the reference to it in the explanation of the 'expand' option in this section: http://gruntjs.com/configuring-tasks#files

@shama
Copy link
Member

shama commented Sep 17, 2013

Interesting, this is the second time this week someone has brought this part of the docs up: gruntjs/grunt#898. The docs are currently in a private wiki but we're in the process of moving them to https://github.com/gruntjs/grunt-docs

It sounds like you're missing targets which at that point in the docs it assumes you have. In your trials is files within a target? e.g., dynamic_mappings, static_mappings, or foo, bar.

Also the files object format accepts mappings of dest: src or dest-as-target formats:

task: {
  target: {
    files: {
      'dest/': ['src/*'],
      'dest2/': ['src2/*'],
  }
}

@odigity
Copy link
Author

odigity commented Sep 17, 2013

I understood the context of the examples -- I know the files block is intended to be embedded in a target block. I was leaving out the irrelevant parts to simplify my point.

I'm not complaining about a bug in execution. I haven't tried to run the examples. I'm merely pointing out what I feel is a naming error in the docs, which is harmful to clarity for noobs such as myself.

@shama
Copy link
Member

shama commented Sep 17, 2013

Ohh, yes I agree you're right. It would be better to call it the files array instead.

@XhmikosR
Copy link
Member

Is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants