1module.exports = function(grunt) { 2 3 grunt.initConfig({ 4 pkg: grunt.file.readJSON('package.json'), 5 6 // Using concat to copy the source. In future, we plan to split the source up, making the concat more appropriate. 7 8 concat: { 9 jplayer: { 10 files: { 11 'dist/jplayer/jquery.jplayer.js': ['src/javascript/jplayer/jquery.jplayer.js'] 12 } 13 }, 14 playlist: { 15 files: { 16 'dist/add-on/jplayer.playlist.js': ['src/javascript/add-on/jplayer.playlist.js'] 17 } 18 }, 19 inspector: { 20 files: { 21 'dist/add-on/jquery.jplayer.inspector.js': ['src/javascript/add-on/jquery.jplayer.inspector.js'] 22 } 23 }, 24 popcorn: { 25 files: { 26 'dist/popcorn/popcorn.jplayer.js': ['src/javascript/popcorn/popcorn.jplayer.js'] 27 } 28 } 29 }, 30 31 uglify: { 32 options: { 33 // maxLineLen: 0 // Generates the output on a single line 34 }, 35 jplayer: { 36 options: { 37 banner: '/*! jPlayer <%= pkg.version %> for jQuery ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 38 }, 39 files: { 40 'dist/jplayer/jquery.jplayer.min.js': ['dist/jplayer/jquery.jplayer.js'] 41 } 42 }, 43 playlist: { 44 options: { 45 banner: '/*! jPlayerPlaylist for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 46 }, 47 files: { 48 'dist/add-on/jplayer.playlist.min.js': ['dist/add-on/jplayer.playlist.js'] 49 } 50 }, 51 inspector: { 52 options: { 53 banner: '/*! jPlayerInspector for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 54 }, 55 files: { 56 'dist/add-on/jquery.jplayer.inspector.min.js': ['dist/add-on/jquery.jplayer.inspector.js'] 57 } 58 }, 59 popcorn: { 60 options: { 61 banner: '/*! Popcorn Player for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 62 }, 63 files: { 64 'dist/popcorn/popcorn.jplayer.min.js': ['dist/popcorn/popcorn.jplayer.js'] 65 } 66 } 67 }, 68 69 sass: { 70 options: { 71 sourcemap: 'none', 72 style: 'nested' 73 }, 74 "blue.monday": { 75 options: { 76 banner: '/*! Blue Monday Skin for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 77 }, 78 files: { 79 'dist/skin/blue.monday/css/jplayer.blue.monday.css': 'src/skin/blue.monday/scss/jplayer.blue.monday.scss' 80 } 81 }, 82 "pink.flag": { 83 options: { 84 banner: '/*! Pink Flag Skin for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n' 85 }, 86 files: { 87 'dist/skin/pink.flag/css/jplayer.pink.flag.css': 'src/skin/pink.flag/scss/jplayer.pink.flag.scss' 88 } 89 } 90 }, 91 92 cssmin: { 93 skins: { 94 files: { 95 'dist/skin/blue.monday/css/jplayer.blue.monday.min.css': ['dist/skin/blue.monday/css/jplayer.blue.monday.css'], 96 'dist/skin/pink.flag/css/jplayer.pink.flag.min.css': ['dist/skin/pink.flag/css/jplayer.pink.flag.css'] 97 } 98 }, 99 }, 100 101 copy: { 102 skins: { 103 files: [ 104 {expand: true, cwd: 'src/skin/blue.monday/', src: ['image/**', 'mustache/**'], dest: 'dist/skin/blue.monday/'}, 105 {expand: true, cwd: 'src/skin/pink.flag/', src: ['image/**', 'mustache/**'], dest: 'dist/skin/pink.flag/'} 106 ] 107 }, 108 }, 109 110 jshint: { 111 112 test: { 113 src: [ 114 'Gruntfile.js', 115 '*.json', 116 'src/javascript/**/*.js', 117 '!**/jquery.jplayer.inspector.js' // The inspector does not pass jshint, and this will be addressed in due course. 118 ] 119 }, 120 121 // jQuery linting guide http://contribute.jquery.org/style-guide/js/#linting 122 // docs http://www/jshint.com/docs/ 123 options: { 124 // Using .jshintrc files for the options. 125 jshintrc: true 126 } 127 }, 128 129 mxmlc: { 130 options: { 131 rawConfig: '-static-link-runtime-shared-libraries=true' 132 }, 133 jplayer: { 134 files: { 135 // Compile and give the SWF a filename like the JavaScript filenames. Important as it is the jPlayer code. 136 'dist/jplayer/jquery.jplayer.swf': ['src/actionscript/Jplayer.as'] 137 } 138 } 139 } 140 }); 141 142 grunt.loadNpmTasks('grunt-contrib-jshint'); 143 grunt.loadNpmTasks('grunt-contrib-concat'); 144 grunt.loadNpmTasks('grunt-contrib-copy'); 145 grunt.loadNpmTasks('grunt-contrib-cssmin'); 146 grunt.loadNpmTasks('grunt-contrib-uglify'); 147 grunt.loadNpmTasks('grunt-contrib-sass'); 148 grunt.loadNpmTasks('grunt-mxmlc'); 149 150 grunt.registerTask('default', ['test', 'build']); 151 152 grunt.registerTask('test', ['jshint']); 153 grunt.registerTask('build', ['js', 'swf', 'css']); 154 grunt.registerTask('js', ['concat', 'uglify']); 155 grunt.registerTask('swf', ['mxmlc']); 156 grunt.registerTask('css', ['sass', 'cssmin', 'copy:skins']); 157}; 158