On Github FilipStenbeck / grunt-presentation
package.json
{
"name": "grunt-demo",
"version": "0.1.0",
"description": "Small demo of grunt",
"author": "Filip Stenbeck",
"license": "BSD",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-watch": "~0.4.3",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-htmlmin": "~0.1.1",
"grunt-usemin": "~0.1.12"
}
}
module.exports = function(grunt) {
grunt.initConfig({
...
..
.
}
};
jshint: {
options: {
jshintrc: '.jshintrc',
},
all: ['Gruntfile.js','script/*.js']
}
concat: {
dist: {
src: ['script/*.js'],
dest: 'dist/js/app.js'
}
}
uglify: {
dist: {
files: {
'dist/js/app-min.js': ['dist/js/app.js' ]
}
}
}
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('build', ['jshint',concat','uglify']);
module.exports = function (grunt) {
var globalConfig = {
src: 'src',
dest: 'dist'
};
...
..
.
jshint: {
all: [
'Gruntfile.js', '<%= globalConfig.src %>/js/{,*/}*.js'
]
},
npm install --save-dev matchdep
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
'concat',
'copy',
'cssmin',
'uglify',
'usemin'
]);
grunt.registerTask('build-with-style', [
'jshint',
'build'
]);
watch: {
coffee: {
files: ['coffee/*.coffee'],
tasks: ['compile','jshint'],
options: {
spawn: false
}
},
javascript: {
files: ['js/*.js'],
tasks: ['jshint'],
options: {
spawn: false
}
}
},