From 7e9566d7be99f945d6ccdfa9f7828d1db8802174 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Mon, 30 Jun 2014 17:18:28 +0200 Subject: tools --- Gruntfile.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Gruntfile.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..8bab037 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,75 @@ +module.exports = function (grunt) { + 'use strict'; + // Project configuration + grunt.initConfig({ + // Metadata + pkg: grunt.file.readJSON('package.json'), + banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' + + ' Licensed <%= props.license %> */\n', + // Task configuration + concat: { + options: { + banner: '<%= banner %>', + stripBanners: true + }, + dist: { + src: ['<%= pkg.name %>.js'], + dest: 'dist/<%= pkg.name %>.js' + } + }, + uglify: { + options: { + banner: '<%= banner %>' + }, + dist: { + src: '<%= concat.dist.dest %>', + dest: 'dist/<%= pkg.name %>.min.js' + } + }, + jshint: { + options: { + node: true, + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + unused: true, + eqnull: true, + boss: true + }, + gruntfile: { + src: 'gruntfile.js' + }, + main: { + src: '<%= pkg.name %>.js' + } + }, + watch: { + gruntfile: { + files: '<%= jshint.gruntfile.src %>', + tasks: ['jshint:gruntfile'] + }, + main: { + files: '<%= jshint.main.src %>', + tasks: ['jshint:main'] + } + } + }); + + // These plugins provide necessary tasks + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-watch'); + + // Default task + grunt.registerTask('default', ['jshint', 'concat', 'uglify']); +}; + -- cgit v1.2.3