twolfson / grunt-curl

Download files from the internet via grunt.
The Unlicense
73 stars 28 forks source link

curl:target doesn't work ? #16

Closed pmaoui closed 10 years ago

pmaoui commented 10 years ago

Hi,

I have an issue while trying to do something like :

curl: {
    dev: {
      'dest1': 'src1',
      'dest2': 'src2'
    },
    prod: {
      'dest3': 'src3',
      'dest4': 'src4'
    }
}

and test them with grunt:dev, grunt:prod... It doesn't seems to work properly.

twolfson commented 10 years ago

The issue is your syntax is invalid. The curl task supports downloading one file at a time. curl-dir supports downloading multiple at a time.

If you want to run multiple curl tasks via a single command, you can define a grunt task for that:

curl: {
    'dest1': 'src1',
    'dest2': 'src2'
    'dest3': 'src3',
    'dest4': 'src4'
}

grunt.registerTask('curl-dev', ['dest1', 'dest2']);
grunt.registerTask('curl-prod', ['dest3', 'dest4']);

However, with the short syntax, this will get unwieldy for the aliasing. Another format is src/dest:

curl: {
    dev1: {
        src: 'src1',
        dest: 'dest1'
    }
    // Similar format for dev2/prod1/prod2
}

grunt.registerTask('curl-dev', ['dev1', 'dev2']);
grunt.registerTask('curl-prod', ['prod1', 'prod2']);
pmaoui commented 10 years ago

Thanks ! It's correct. Just one thing about your example, I had to correct your syntax this way :

grunt.registerTask('curl-dev', ['curl:dev1', 'curl:dev2']);
grunt.registerTask('curl-prod', ['curl:prod1', 'curl:prod2']);