How to copy a sub directory to a root directory using grunt-contrib-copy?

103 views Asked by At

My structure is like below. I want to copy assets folder from app directory to dist directory?

app
   assets
      imgs
      css
      fonts
   index.html
dist
1

There are 1 answers

0
Daniel Olszewski On BEST ANSWER

Set the current working directory to app. Select all subdirs and files of assets. Set the destination to dest.

grunt.initConfig({
    copy: {
        dist: {
            cwd: 'app',
            src: ['assets/**/*'],
            dest: 'dist/',
            expand: true
        }
    }
});

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['copy:dist']);