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

How can I copy to multiple destinations? #59

Closed
F21 opened this issue Mar 12, 2013 · 2 comments
Closed

How can I copy to multiple destinations? #59

F21 opened this issue Mar 12, 2013 · 2 comments

Comments

@F21
Copy link

F21 commented Mar 12, 2013

Here's my current config:

copy: {
      build: {
        files: [
            //Copy the javascript files
            {
              expand: true,     // Enable dynamic expansion.
              cwd: 'scripts/',
              src: ['**/*.js'], // Actual pattern(s) to match.
              dest: '../js/',   // Destination path prefix.
              ext: '.js',   // Dest filepaths will have this extension.
              rename: function(dest, src){
                    return dest + src; //this is actually much more complicated in my code
              }
            },

            //Copy the javascript files -debug
            {
              expand: true,     // Enable dynamic expansion.
              cwd: '../js/',
              src: ['**/*.js'], // Actual pattern(s) to match.
              dest: '../js/',   // Destination path prefix.
              ext: '-debug.js',   // Dest filepaths will have this extension.
            },
        ],
      }
    }

What I want to do is this:

  1. Drop into scripts folder and do some processing and renaming so that the result lives in ../js.
  2. Go into ../js and go through each .js file and for each file, make an exact copy in the exact location with the filename ending in -debug.js.

With my current config, if I run grunt the first time, only the first task (drop into scripts and do the processing/copying)` would run.

I need to run grunt again in order for the second copy (debug) to be generated.

It seems to me that before performing any copy, it actually first check to see if all the copy rules can be executed even though the second copy rule depends on the first one.

Is there anyway to make grunt ignore that and just run the first then second rule sequentially?

@tkellen
Copy link
Member

tkellen commented Mar 12, 2013

This should be filed on Grunt. Opening an issue that references this over there.

@tkellen tkellen closed this as completed Mar 12, 2013
@tkellen
Copy link
Member

tkellen commented Mar 12, 2013

Actually, if you just put the second set of files you want to copy in another target you'll be good to go.

Something like this:

copy: {
  build: {
    expand: true,
    cwd: 'scripts/',
    src: ['**/*.js'], 
    dest: '../js/',
    ext: '.js'
  },
  debug: {
    expand: true, 
    cwd: '../js/',
    src: ['**/*.js'], 
    dest: '../js/',   
    ext: '-debug.js',
  }
}

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