Tapas Jena
Tapas Jena

Reputation: 1109

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

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

Upvotes: 0

Views: 92

Answers (1)

Daniel Olszewski
Daniel Olszewski

Reputation: 14401

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']);

Upvotes: 1

Related Questions