Last active
August 29, 2015 14:03
-
-
Save milmazz/46a14b4694ff0aaf7250 to your computer and use it in GitHub Desktop.
Grunt: The Javascript Task Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
jsdoc : { | |
dist : { | |
src: ['src/*.js', 'test/*.js'], | |
dest: 'doc' | |
} | |
}, | |
jshint: { | |
options: { | |
jshintrc: '.jshintrc' | |
}, | |
all: ['Gruntfile.js', 'src/*.js', 'test/*.js'] | |
}, | |
jsbeautifier: { | |
modify: { | |
src: 'index.js', | |
options: { | |
config: '.jsbeautifyrc' | |
} | |
}, | |
verify: { | |
src: ['index.js'], | |
options: { | |
mode: 'VERIFY_ONLY', | |
config: '.jsbeautifyrc' | |
} | |
} | |
}, | |
htmlmin: { | |
dist: { | |
options: { | |
removeComments: true, | |
collapseWhitespace: true | |
}, | |
files: { | |
'dist/index.html': 'src/index.html', // 'destination': 'source' | |
'dist/contact.html': 'src/contact.html' | |
} | |
} | |
}, | |
cssmin: { | |
add_banner: { | |
options: { | |
banner: '/* My minified css file */' | |
}, | |
files: { | |
'path/to/output.css': ['path/to/**/*.css'] | |
} | |
} | |
}, | |
uglify: { | |
options: { | |
banner: '/* <%= grunt.template.today("yyyy-mm-dd") %> */\n', | |
separator: ',', | |
compress: true, | |
}, | |
chart: { | |
src: 'src/<%= pkg.name %>.js', | |
dest: 'build/<%= pkg.name %>.min.js' | |
} | |
}, | |
}); | |
// Load the plugin that provides the 'jsdoc' task. | |
grunt.loadNpmtasks('grunt-jsdoc'); | |
// Load the plugin that provides the 'jshint' task. | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
// Load the plugin that provides the 'jsbeautifier' task. | |
grunt.loadNpmTasks('grunt-jsbeautifier'); | |
// Load the plugin that provides the 'uglify' task. | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
// Load the plugin that provides the 'htmlmin' task. | |
grunt.loadNpmTasks('grunt-contrib-htmlmin'); | |
// Load the plugin that provides the 'cssmin' task. | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
// Wrapper around htmlmin, cssmin and uglify tasks. | |
grunt.registerTask('minified', [ | |
'htmlmin', | |
'cssmin', | |
'uglify' | |
]); | |
// Default task | |
grunt.registerTask('default', ['jshint']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment