2013-08-22 40 views
0

我正在为字体端开发环境运行grunt。基本Grunt.js用法:如何创建正确的目录结构

我有以下目录结构:

Project 
    - Dev { My test dir for the build } 
     - www 
     - img 
      - dir 1 
      - dir 2 

    - Dist { The distribution dir, post grunt compile } 

我有以下代码到图像文件中穿过我的grunt.js文件复制:

​​

此份文件,但是我当我真的想要dist/img /(dir 1等)时,最终会获得dist/dev/img /(dir1等)。我究竟做错了什么?

回答

0

对于那些感兴趣的人,我在这里找到答案:https://github.com/gruntjs/grunt-contrib-copy

您需要使用CWD设置基本目录:

  expand: true, 
      cwd: 'dev/', 
      src: ['img/*'], 
      dest: 'dist/img/', 
      flatten: true, 
      filter: 'isFile', 
+2

如果有下的IMG目录下子目录中的文件,你需要使用'[“IMG/**/*”] '否则你只是复制直接在** img/**中但不在子目录中的文件。 –