diff --git a/.gitignore b/.gitignore index fd4f2b06..0738cb50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +dist \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 016f95c8..395cdde1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,11 +1,34 @@ module.exports = function(grunt) { grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + qunit: { files: ['test/index.html'] + }, + + uglify: { + options: { + banner: '/*!\n' + + '* <%= pkg.name %> JavaScript Library v<%= pkg.version %>\n' + + '* <%= pkg.homepage %>\n' + + '*\n' + + '*\n' + + '* Released under the <%= pkg.license.type %> license\n' + + '* <%= pkg.license.url %>\n' + + '*\n' + + '* Date: <%= grunt.template.today("yyyy-mm-dd") %>\n' + + '*\n' + + '*/\n' + }, + dist: { + files: {'dist/<%= pkg.name %>.min.js' : ['<%= pkg.name %>.js']} + } } }); grunt.loadNpmTasks("grunt-contrib-qunit"); + grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.registerTask('test', 'qunit'); grunt.registerTask('default', ['qunit']); + grunt.registerTask('build', ['qunit', 'uglify']); }; diff --git a/README.md b/README.md index 22b242b6..84df9060 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ var VerEx = require("verbal-expressions"); (or) $ grunt test +## Creating a minified version + +This will generate a minified version of VerbalExpressions.js (aptly named VerbalExpressions.min.js) in a _dist_ folder. + + $ grunt build + ## Examples Here's a couple of simple examples to give an idea of how VerbalExpressions works: diff --git a/VerbalExpressions.js b/VerbalExpressions.js index 397f3b98..79427fea 100644 --- a/VerbalExpressions.js +++ b/VerbalExpressions.js @@ -4,7 +4,7 @@ * * * Released under the MIT license - * http://jquery.org/license + * http://opensource.org/licenses/MIT * * Date: 2013-07-19 * diff --git a/package.json b/package.json index 73c1c8d2..eceb72ed 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,13 @@ { - "name": "verbal-expressions", + "name": "VerbalExpressions", "description": "JavaScript Regular expressions made easy", "version": "0.1.2", "keywords": [ "regular expressions", "regex" ], + "homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions", "devDependencies": { "grunt": "~0.4.2", - "grunt-contrib-qunit": "~0.2.2" + "grunt-contrib-qunit": "~0.2.2", + "grunt-contrib-uglify": "~0.2.2" }, "repository": { "type": "git", @@ -15,7 +17,10 @@ "url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues" }, "main": "VerbalExpressions.js", - "license": "MIT", + "license": { + "type": "MIT", + "url": "http://opensource.org/licenses/MIT" + }, "engines": { "node": ">= 0.8.0" }