diff --git a/Gruntfile.js b/Gruntfile.js index 6e5ef04..e6e550e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,76 +1,72 @@ /*global module:false*/ module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-contrib'); - grunt.loadNpmTasks('grunt-coffee'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-coffee'); // Project configuration. grunt.initConfig({ - pkg: '', + pkg: grunt.file.readJSON('package.json'), meta: { banner: '/*!\n * <%= pkg.title %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + ' * <%= pkg.homepage %>/\n' + ' * Copyright (c) <%= grunt.template.today("yyyy") %> ' + - '<%= pkg.author.name %> <<%= pkg.author.url %>>\n */', - - lib: { - intro: ';(function($) {\n' + - 'var meta = { ' + - 'version: "<%= pkg.version %>", ' + - 'name: "<%= pkg.title %>" ' + - '};', - outro: '})(window.jQuery);' - } + '<%= pkg.author.name %> <<%= pkg.author.url %>>\n */\n' }, clean: { - files: ['build/**/*'] + options: { + force: true + }, + build: ["build"] }, coffee: { lib: { - src: '<%= pkg.directories.lib %>/**/*.coffee', - options: { - preserve_dirs: true + options: { + join: true, + bare: false + }, + files: { + '<%= pkg.directories.build %>/<%= pkg.name %>.js': [ + '<%= pkg.directories.lib %>/utils.coffee', + '<%= pkg.directories.lib %>/runner.coffee', + '<%= pkg.directories.lib %>/expose.coffee' + ] } - } + }, }, concat: { - lib: { - src: [ - '', - '', - '<%= pkg.directories.lib %>/utils.js', - '<%= pkg.directories.lib %>/runner.js', - '<%= pkg.directories.lib %>/expose.js', - '' - ], + finish: { + options: { + banner: '<%= meta.banner %>', + process: true + }, + src: ['<%= pkg.directories.build %>/<%= pkg.name %>.js'], dest: '<%= pkg.directories.build %>/<%= pkg.name %>.js' } }, - min: { + uglify: { + options: { + banner: '<%= meta.banner %>' + }, lib: { - src: ['', ''], - dest: '<%= pkg.directories.build %>/<%= pkg.name %>-min.js' - } - }, - - watch: { - coffee: { - files: '', - tasks: 'coffee' + files: { + '<%= pkg.directories.build %>/<%= pkg.name %>-min.js': '<%= concat.finish.dest %>' + } } } }); - grunt.registerTask('default', 'clean coffee concat'); - grunt.registerTask('minify', 'min'); - grunt.registerTask('release', 'default minify'); - grunt.registerTask('lib', 'coffee:lib concat:lib'); - grunt.registerTask('lib-min', 'concat:lib min:lib'); -}; + grunt.registerTask('default', ['clean', 'coffee', 'concat']); + grunt.registerTask('release', ['default', 'uglify']); + grunt.registerTask('lib', ['coffee', 'concat']); +}; \ No newline at end of file diff --git a/package.json b/package.json index b2f57ae..94f9ba0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jquery.runner", "title": "jQuery-runner", - "version": "2.1.1", + "version": "2.1.2", "description": "A simple runner/stopwatch jQuery plugin for counting time up and down.", "homepage": "https://github.com/jylauril/jquery-runner", "main": "build/jquery.runner.js", @@ -54,8 +54,11 @@ ], "license": "MIT", "dependencies": { - "grunt": ">=0.3.17", - "grunt-contrib": ">=0.3.0", - "grunt-coffee": "0.0.6" + "grunt": ">=0.4.0", + "grunt-contrib-uglify": ">=0.1.2", + "grunt-contrib-concat": ">=0.1.3", + "grunt-contrib-clean": ">=0.4.0", + "grunt-contrib-copy": ">=0.4.0", + "grunt-contrib-coffee": ">=0.6.0" } } diff --git a/runner.jquery.json b/runner.jquery.json index ea52fab..0b68c2f 100644 --- a/runner.jquery.json +++ b/runner.jquery.json @@ -1,7 +1,7 @@ { "name": "runner", "title": "jQuery-runner", - "version": "2.1.1", + "version": "2.1.2", "description": "A simple runner/stopwatch jQuery plugin for counting time up and down.", "homepage": "https://github.com/jylauril/jquery-runner", "docs": "https://github.com/jylauril/jquery-runner",