The configuration you specified only looks at the root directory; if you want the whole folder why not just specify that?
copy: {
main: {
files: {
'build': 'App'
}
}
}
Question
I'm a bit new to grunt and am trying to get it to copy over the entire contents of the src directory (App) to the dest directory (build).
It's only copying over the App folder but none of it's child folders and files. How can I get it to copy over everything? Any help would be really appreciated. Please see my gruntfile below.
thanks - chris
module.exports = function(grunt) {
// INITIALIZE TASKS
grunt.initConfig({
// PACKAGE INFO
pkg: grunt.file.readJSON('package.json'),
// ENVIRONMENT SETTINGS
env: 'dev',
// CLEAN BUILD FOLDER
clean: {
options: {
force: true
},
build: [
'build/App/buildlates',
'build/App/styles/app',
'build/App/styles/vendor',
'build/App/scripts/app',
'build/App/scripts/vendor',
'build/App/scripts',
'build/App/styles',
'build/App/img',
'build/App',
'build'
]
},
// COPY DEV CODE INTO BUILD
copy: {
main: {
files: {
'build/': ['App/**']
}
}
},
// JSHINT
jshint: {
files: [
'App/scripts/app/angular/**/*.js'
],
options: {
ignores: [
'App/scripts/app/*.js',
'App/scripts/app/angular/directives/vendor/**'
]
}
},
// LESS PROCESSING
less: {
development: {
options: {
paths: ['build/App/styles/app']
},
files: {
'build/App/styles/app/css/main.css': 'build/App/styles/app/main.less',
'build/App/styles/app/css/another.css': 'build/App/styles/app/another.less'
}
}
},
// CONCAT
concat: {
css : {
src: ['build/App/styles/app/css/*.css'],
dest: 'build/App/styles/app/css/styles.css'
},
js : {
src: [
'build/App/scripts/app/angular/*.js',
'build/App/scripts/app/angular/objects/*.js',
'build/App/scripts/app/angular/modules/*.js',
'build/App/scripts/app/angular/services/*.js',
'build/App/scripts/app/angular/directives/*.js',
'build/App/scripts/app/angular/filters/*.js',
'build/App/scripts/app/angular/controllers/*.js'
],
dest: 'build/App/scripts/app/angular/release/app.js'
}
},
// MINIMIZE CSS
cssmin: {
minify: {
expand: true,
cwd: 'build/App/styles/app/css/',
src: ['styles.css', '!*.min.css'],
dest: 'build/App/styles/app/css/',
ext: '.min.css'
}
},
// MINIMIZE JAVASCRIPT
'jsmin-sourcemap': {
all: {
src: ['build/App/scripts/app/angular/release/app.js'],
dest: 'build/App/scripts/app/angular/release/app.min.js',
destMap: 'build/App/scripts/app/angular/release/app.js.map'
}
},
// WATCH FOR CHANGES
watch: {
src: {
options: { livereload: true },
files: ['App/scripts/app/**', 'App/styles/app/*.less', 'App/templates/**'],
tasks: ['jshint', 'less', 'preprocess'],
}
},
// PREPROCESS HTML BUILD DIRECTIVES
preprocess: {
options: {
context: {
ENVIRONMENT: '<%= env %>'
}
},
html: {
src: 'App/templates/environmentChecker.html',
dest: 'build/App/templates/environmentChecker.html'
}
}
});
// LOAD TASKS
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-jsmin-sourcemap');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-preprocess');
// REGISTER TASKS
grunt.registerTask('default', ['clean:build', 'copy', 'jshint']);
grunt.registerTask('dev', ['jshint', 'clean:build', 'clean:build', 'copy', 'less:development', 'preprocess', 'watch']);
grunt.registerTask('prod', ['jshint', 'clean:build', 'clean:build', 'copy', 'less:development', 'concat:css', 'cssmin', 'concat:js', 'jsmin-sourcemap', 'preprocess']);
};
La solution
The configuration you specified only looks at the root directory; if you want the whole folder why not just specify that?
copy: {
main: {
files: {
'build': 'App'
}
}
}