[英]Basic Grunt.js usage: How to create the correct directory structure
I am running grunt for a font-end development environment. 我正在为字体端开发环境而苦恼。
I have the following directory structure: 我有以下目录结构:
Project
- Dev { My test dir for the build }
- www
- img
- dir 1
- dir 2
- Dist { The distribution dir, post grunt compile }
I have the following code to copy the image files across in my grunt.js file: 我有以下代码将图像文件复制到我的grunt.js文件中:
img: {
expand: false,
src: ["dev/img/*"],
dest: 'dist/img/',
},
This copies files fine, but I end up with dist/dev/img/(dir1 etc) when I actually want dist/img/(dir 1 etc). 这样可以很好地复制文件,但是当我实际上想要dist / img /(dir 1等)时,我最终得到dist / dev / img /(dir1等)。 What am I doing wrong?
我究竟做错了什么?
For those interested, I found the answer here: https://github.com/gruntjs/grunt-contrib-copy . 对于那些感兴趣的人,我在这里找到了答案: https : //github.com/gruntjs/grunt-contrib-copy 。
You need to use the CWD to set the base dir: 您需要使用CWD来设置基本目录:
expand: true,
cwd: 'dev/',
src: ['img/*'],
dest: 'dist/img/',
flatten: true,
filter: 'isFile',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.