You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

103 lines
2.2 KiB

'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'js/*.js',
'!js/main.js'
]
},
watch: {
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['jshint', 'uglify', 'surround'],
options: {
livereload: true
}
},
},
uglify: {
dist: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */',
compress: true,
beautify: false,
mangle: false
},
files: {
'js/main.js': [
'js/plugins/*.js',
'js/_*.js'
]
}
}
},
surround: {
src: 'js/main.js',
options: {
overwrite: true,
prepend: '---\n---',
},
},
imagemin: {
dist: {
options: {
optimizationLevel: 7,
progressive: true
},
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.{png,jpg,jpeg}',
dest: 'images/'
}]
}
},
imgcompress: {
dist: {
options: {
optimizationLevel: 7,
progressive: true
},
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.{png,jpg,jpeg}',
dest: 'images/'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: 'images/',
src: '{,*/}*.svg',
dest: 'images/'
}]
}
},
});
// Load tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-imgcompress');
grunt.loadNpmTasks('grunt-surround');
// Register tasks
grunt.registerTask('scripts', ['watch', 'uglify']);
grunt.registerTask('images', ['newer:imgcompress', 'newer:svgmin']);
};