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

Make it true multitask #12

Open
luiz-brandao opened this issue Apr 1, 2015 · 2 comments
Open

Make it true multitask #12

luiz-brandao opened this issue Apr 1, 2015 · 2 comments

Comments

@luiz-brandao
Copy link

This task doesn't seem to be a multitask. I'm new to Grunt but it seems Grunt sends different parameters when you have multiple tasks setup. For it to work properly as a multitask, the code at pot.js:87 should be changed to something like this:

    this.files[0].src.forEach(function(file) {
        if( !grunt.file.isDir( file ) ){
            inputFiles +=  " " + file;
        }
    });

If this alteration is made, the setup should change to something similar to the following :

pot: {
    first_task: {
        options: {
            text_domain: text_domain,
            dest: 'build/languages/',
            keywords: ['gettext', '__', '_e']
        },
        files: {
            src: ['build/**'],
            expand: true
        }
    }
}
@stephenharris
Copy link
Owner

You're right, although defined as a multi-task you will get an error if you use it as such. Using it as follows should work though:

pot: {
        options: {
            text_domain: text_domain,
            dest: 'build/languages/',
            keywords: ['gettext', '__', '_e']
        },
        files: {
            src: ['build/**'],
            expand: true
        }
}

I haven't had time to investigate what the actual bug is, but the proposed fix seems odd for two reasons:

  1. The current line does follow the API documentation: http://gruntjs.com/api/inside-tasks#this.files
  2. The fix seems to suggest looping through this.files[0] - what's so special about that index? My concern is that if you had multiple tasks then actually you'll always be using the files from the first (this is just speculative thinking). Have you tried the fix with multiple tasks?

In short, yes there's a bug, but I'm not sure if that's where it is :)

@luiz-brandao
Copy link
Author

Yeah, it does look weird but that's where to problem was. Maybe my fix is not the ideal fix, but it works. I analyzed the data passed by Grunt and the files array was different from what it was before when using the multi-task configuration. I will see if I can pinpoint why.

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

2 participants