From 77551b1a944b87b4877e10d8b19634134af4d0be Mon Sep 17 00:00:00 2001 From: Brandon Aaron Date: Mon, 11 Mar 2013 21:17:08 -0500 Subject: [PATCH] use grunt for jshint and uglify --- .gitignore | 2 ++ .jshintrc | 5 +++-- Gruntfile.js | 27 +++++++++++++++++++++++++++ package.json | 11 +++++++---- 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 Gruntfile.js diff --git a/.gitignore b/.gitignore index ab49093a6..733c8ab69 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /npm-debug.log +/build +/node_modules \ No newline at end of file diff --git a/.jshintrc b/.jshintrc index 4a68afd94..862068c59 100644 --- a/.jshintrc +++ b/.jshintrc @@ -15,5 +15,6 @@ "regexp": true, "strict": false, "trailing": true, - "unused": true -} \ No newline at end of file + "unused": true, + "globals": { "define": true } +} diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 000000000..71299bf34 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,27 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + uglify: { + options: { + preserveComments: 'some' + }, + build: { + src: '<%= pkg.name %>.js', + dest: 'build/<%= pkg.name %>.min.js' + } + }, + jshint: { + all: ['*.js'] + } + }); + + // Load the plugin that provides the "uglify" task. + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + + // Default task(s). + grunt.registerTask('default', ['jshint', 'uglify']); + +}; diff --git a/package.json b/package.json index 7943b1224..b8f19eba9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { - "scripts": { - "check": "jshint .", - "lint": "jshint ." + "name" : "jquery.mousewheel", + "version": "3.1.1", + "devDependencies": { + "grunt-contrib-jshint": "~0.2.0", + "grunt-contrib-uglify": "~0.1.2", + "grunt": "~0.4.0" } -} \ No newline at end of file +}