Grunt Copy Flatten not working as expected

余生颓废 提交于 2019-12-04 01:35:15

Well, if you're only using flatten because you want everything in source/libraries to go into build, I would suggest actually using the cwd (current working directory) option instead. If, on the other hand, you actually have subfolders in source/libraries then you probably want that src line to be source/libraries/**/*.js.

In any case, if you can use cwd instead it would look like this:

copy: {
  main: {
    files: [
      {
        src: ["*.js"],
        dest: "build/",
        cwd: "source/libraries/"
      }
    ]
  }

For the other case, maybe this? (Notice the expand option set to true)

copy: {
  main: {
    files: [
      {
        src: ["source/libraries/**/*.js"],
        dest: "build/",
        flatten: true,
        expand: true
      }
    ]
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!