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:
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). What am I doing wrong?
For those interested, I found the answer here: https://github.com/gruntjs/grunt-contrib-copy .
You need to use the CWD to set the base dir:
expand: true,
cwd: 'dev/',
src: ['img/*'],
dest: 'dist/img/',
flatten: true,
filter: 'isFile',
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.