summaryrefslogtreecommitdiffstats
path: root/GruntFile.js
blob: b17beab181ddd4b4a6f7221fc85487ed735cc7d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      // gruntjs.com/configuring-tasks#globbing-patterns
      // **/** matches in current and sub dirs
      all: ['./'], // current dir and sub dirs
      sub: ['*/'], // sub dirs
      dir: ['*.js'], // current dir
      src: ['src/'],
      test: ['test/'],
      grunt: ['GruntFile.js'],
      build: ['<%= pkg.name %>.js'],
      options: {
        ignores: ['**/**/node_modules/', '**/**/vendor/', '**/**.min.js'],
        debug:true, expr:true, sub:true, boss:true, supernew:true, node:true, 
        undef:true, unused:true, devel:true, evil:true, laxcomma:true, eqnull:true, 
        browser:true, globals:{ender:true}, jquery:true, maxerr:10
      }
    },
    concat: {
      options: {
        banner: [
          '/*!',
          ' * <%= pkg.name %> <%= pkg.version %>+<%= grunt.template.today("UTC:yyyymmddHHMM") %>',
          ' * <%= pkg.homepage %>',
          ' * MIT License 2013 <%= pkg.author %>',
          ' */\n\n'
        ].join('\n')
      },
      build: {
        files: {
          '<%= pkg.name %>.js': ['src/<%= pkg.name %>.js']
        }
      }
    },
    uglify: {
      options: {
        report: 'gzip',
        preserveComments: 'some'
      },
      build: {
        files: {
          '<%= pkg.name %>.min.js': ['<%= pkg.name %>.js']
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.registerTask('default', ['jshint:grunt', 'jshint:sub', 'concat', 'jshint:build', 'uglify']);
};