lundi 29 juin 2015

Destination file that reflects source folders grunt

sorry if the name of this thread is a bit weird. It's hard to explain in one line.

Basically, this is what I want my folder setup to look like:

                html5
                  |
   src-----------------------build------_config
    |                           |           |
  master                      master    Gruntfiles etc
    |                           |
css-images-js-index.html        |
 |    |    |                    |
.css .jpg .js                   |
                                |
                           .css .jpg .js

From my root folder (html5) I have a src and a build folder. In both of them, there will be a lot of more folders than the master folder, all of which will have the same layout (different formats). What I basically want to happen, is I want the content in the src > master folder to be flattened into the corresponding build > master folder. I've tried the flatten option shown here, however, that flattens the entire thing, causing the contents of the master folder to be put straight in the build folder, which is not what I want. I've been messing some with the rename function, but it seems overly complicated for this task. Is there no other way to do this?

EDIT: I have this task:

    copy: {
        images: {
            files: [
                {
                    expand: true,
                    flatten: true,
                    cwd: "../src/",
                    src: ["**"],
                    dest: "../build/master",
                    filter: "isFile"
                },
            ]
        }
    },

Which does exactly what it's supposed to do. However, I really need the destination folder "master" to be dynamic. It should not be hard-coded like it is right now. It needs to be the corresponding folder that was copied from the src folder. It doesn't work to put "**" there unfortunately.

Aucun commentaire:

Enregistrer un commentaire