Skip to content

Instantly share code, notes, and snippets.

@tangorri
Last active December 28, 2015 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangorri/7561767 to your computer and use it in GitHub Desktop.
Save tangorri/7561767 to your computer and use it in GitHub Desktop.
how to concat all my js files in src/script (with js files inside of it and fils in each subdir) ? The output is x3 ....
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
build: {
src: ['build']
}
},
copy: {
assets: {
files: [{
expand: true,
cwd: 'src/img/',
src: ['**'],
dest: 'build/img/'
}, {
expand: true,
cwd: 'src/templates/',
src: ['**'],
dest: 'build/templates/'
}, {
expand: true,
cwd: 'src/css/',
src: ['**', '!*.less'],
dest: 'build/css/'
}, {
expand: true,
cwd: 'src/vendor/',
src: ['**'],
dest: 'build/vendor/'
}, ]
}
},
processhtml: {
dist: {
files: {
'build/index.html': ['src/index.html']
}
}
},
uglify: {
options: {
report: 'min',
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
},
build: {
src: 'build/script/',
dest: 'build/script/app.min.js',
}
},
concat: {
build: {
src: ['src/script/**/*.js'],
dest: 'build/script/app2.js'
}
},
cssmin: {
build: {
files: {}
}
},
ngmin: {
dist: {
files: [{
expand: true,
cwd: 'src/script',
src: ['**/*.js'],
dest: 'build/script'
}]
}
},
less: {
development: {
options: {
report: 'min',
},
src: 'src/css/styles.less',
dest: 'build/css/styles.css',
},
},
htmlbuild: {
build: {
src: 'src/index.html',
dest: 'build/index.html',
options: {}
},
},
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-ngmin');
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['clean', 'copy', 'processhtml', 'concat']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment