|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +module.exports = function(grunt) { |
| 4 | + |
| 5 | + // Project configuration. |
| 6 | + grunt.initConfig({ |
| 7 | + // Metadata. |
| 8 | + pkg: grunt.file.readJSON('jquery-ui-timepicker-addon.json'), |
| 9 | + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + |
| 10 | + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + |
| 11 | + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + |
| 12 | + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + |
| 13 | + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', |
| 14 | + // Task configuration. |
| 15 | + clean: { |
| 16 | + files: ['dist'] |
| 17 | + }, |
| 18 | + copy: { |
| 19 | + dist: { |
| 20 | + files: [ |
| 21 | + //{ src: 'src/index.html', dest: 'dist/index.html' }, |
| 22 | + { src: 'src/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' }, |
| 23 | + { src: 'src/jquery-ui-sliderAccess.js', dest: 'dist/jquery-ui-sliderAccess.js' }, |
| 24 | + { src: 'src/i18n/jquery-ui-timepicker-*.js', dest: 'dist/i18n/', expand:true, flatten: true } |
| 25 | + ] |
| 26 | + } |
| 27 | + }, |
| 28 | + concat: { |
| 29 | + dist: { |
| 30 | + options: { |
| 31 | + banner: '<%= banner %>', |
| 32 | + stripBanners: true |
| 33 | + }, |
| 34 | + src: ['src/<%= pkg.name %>.js'], |
| 35 | + dest: 'dist/<%= pkg.name %>.js' |
| 36 | + }, |
| 37 | + docs: { |
| 38 | + src: [ |
| 39 | + 'src/docs/header.html', |
| 40 | + 'src/docs/intro.html', |
| 41 | + 'src/docs/options.html', |
| 42 | + 'src/docs/formatting.html', |
| 43 | + 'src/docs/i18n.html', |
| 44 | + 'src/docs/examples.html', |
| 45 | + 'src/docs/footer.html' |
| 46 | + ], |
| 47 | + dest: 'dist/index.html' |
| 48 | + } |
| 49 | + }, |
| 50 | + uglify: { |
| 51 | + options: { |
| 52 | + banner: '<%= banner %>' |
| 53 | + }, |
| 54 | + dist: { |
| 55 | + src: '<%= concat.dist.dest %>', |
| 56 | + dest: 'dist/<%= pkg.name %>.min.js' |
| 57 | + } |
| 58 | + }, |
| 59 | + cssmin: { |
| 60 | + options: { |
| 61 | + banner: '<%= banner %>' |
| 62 | + }, |
| 63 | + dist: { |
| 64 | + src: 'dist/<%= pkg.name %>.css', |
| 65 | + dest: 'dist/<%= pkg.name %>.min.css' |
| 66 | + } |
| 67 | + }, |
| 68 | + replace: { |
| 69 | + dist: { |
| 70 | + options: { |
| 71 | + variables: { |
| 72 | + version: '<%= pkg.version %>', |
| 73 | + timestamp: '<%= grunt.template.today("yyyy-mm-dd") %>' |
| 74 | + }, |
| 75 | + prefix: '@@' |
| 76 | + }, |
| 77 | + files: [ |
| 78 | + { src: 'dist/<%= pkg.name %>.js', dest: 'dist/<%= pkg.name %>.js' }, |
| 79 | + { src: 'dist/<%= pkg.name %>.css', dest: 'dist/<%= pkg.name %>.css' }, |
| 80 | + { src: 'dist/index.html', dest: 'dist/index.html' } |
| 81 | + ] |
| 82 | + } |
| 83 | + }, |
| 84 | + jasmine: { |
| 85 | + src: 'src/<%= pkg.name %>.js', |
| 86 | + options: { |
| 87 | + specs: 'test/*_spec.js', |
| 88 | + vendor: [ |
| 89 | + 'http://code.jquery.com/jquery-1.10.1.min.js', |
| 90 | + 'http://code.jquery.com/ui/1.10.3/jquery-ui.min.js', |
| 91 | + 'http://github.com/searls/jasmine-fixture/releases/1.0.5/1737/jasmine-fixture.js' |
| 92 | + ] |
| 93 | + } |
| 94 | + }, |
| 95 | + jshint: { |
| 96 | + gruntfile: { |
| 97 | + options: { |
| 98 | + jshintrc: '.jshintrc' |
| 99 | + }, |
| 100 | + src: 'Gruntfile.js' |
| 101 | + }, |
| 102 | + src: { |
| 103 | + options: { |
| 104 | + jshintrc: 'src/.jshintrc' |
| 105 | + }, |
| 106 | + src: ['src/**/*.js'] |
| 107 | + }, |
| 108 | + test: { |
| 109 | + options: { |
| 110 | + jshintrc: 'test/.jshintrc' |
| 111 | + }, |
| 112 | + src: ['test/**/*.js'] |
| 113 | + } |
| 114 | + }, |
| 115 | + watch: { |
| 116 | + gruntfile: { |
| 117 | + files: '<%= jshint.gruntfile.src %>', |
| 118 | + tasks: ['jshint:gruntfile'] |
| 119 | + }, |
| 120 | + src: { |
| 121 | + files: 'src/**',//'<%= jshint.src.src %>', |
| 122 | + tasks: ['jshint:src', 'jasmine', 'clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin'] |
| 123 | + //tasks: ['jshint:src', 'jasmine'] |
| 124 | + }, |
| 125 | + test: { |
| 126 | + files: '<%= jshint.test.src %>', |
| 127 | + tasks: ['jshint:test', 'jasmine'] |
| 128 | + } |
| 129 | + } |
| 130 | + }); |
| 131 | + |
| 132 | + // These plugins provide necessary tasks. |
| 133 | + grunt.loadNpmTasks('grunt-contrib-clean'); |
| 134 | + grunt.loadNpmTasks('grunt-contrib-concat'); |
| 135 | + grunt.loadNpmTasks('grunt-contrib-copy'); |
| 136 | + grunt.loadNpmTasks('grunt-replace'); |
| 137 | + grunt.loadNpmTasks('grunt-contrib-uglify'); |
| 138 | + grunt.loadNpmTasks('grunt-contrib-cssmin'); |
| 139 | + grunt.loadNpmTasks('grunt-contrib-jasmine'); |
| 140 | + grunt.loadNpmTasks('grunt-contrib-jshint'); |
| 141 | + grunt.loadNpmTasks('grunt-contrib-watch'); |
| 142 | + |
| 143 | + // Default task. |
| 144 | + grunt.registerTask('default', ['jshint', 'jasmine', 'clean', 'copy', 'concat', 'replace', 'uglify', 'cssmin']); |
| 145 | + |
| 146 | +}; |
0 commit comments