Dateigrösse: 2.05 kb
1 module.exports = function(grunt) { 2 grunt.initConfig({ 3 pkg: grunt.file.readJSON('package.json'), 4 browserify: { 5 'test/test-require.js': ['test/src/require/test.js'], 6 options: { 7 banner: '/*\n\n ****** Testing Require file ****** \n\n*/' 8 } 9 }, 10 jshint: { 11 files: ['Gruntfile.js', 'dist/jquery.browser.js', 'test/test.js'], 12 13 options: { 14 globals: { 15 jQuery: true, 16 console: true, 17 module: true 18 } 19 } 20 }, 21 uglify: { 22 options: { 23 banner: '/*!\n * jQuery Browser Plugin <%= pkg.version %>\n * https://github.com/gabceb/jquery-browser-plugin\n *\n * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors\n * http://jquery.org/license\n *\n * Modifications Copyright <%= grunt.template.today("yyyy") %> Gabriel Cebrian\n * https://github.com/gabceb\n *\n * Released under the MIT license\n *\n * Date: <%= grunt.template.today("dd-mm-yyyy")%>\n */' 24 }, 25 dist: { 26 files: { 27 'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js' 28 } 29 } 30 }, 31 copy: { 32 main: { 33 src: "dist/<%= pkg.name %>.js", 34 dest: "test/src/<%= pkg.name %>.js" 35 } 36 }, 37 exec: { 38 'test-jquery': { 39 command: "casperjs test test/test.js", 40 stdout: true, 41 stderr: true 42 }, 43 'test-require': { 44 command: "./node_modules/.bin/mocha test/test-require.js", 45 stdout: true, 46 stderr: true 47 } 48 } 49 }); 50 51 grunt.loadNpmTasks('grunt-contrib-jshint'); 52 grunt.loadNpmTasks('grunt-contrib-uglify'); 53 grunt.loadNpmTasks('grunt-contrib-copy'); 54 grunt.loadNpmTasks('grunt-exec'); 55 grunt.loadNpmTasks('grunt-browserify'); 56 57 grunt.registerTask('default', ['jshint', 'uglify', 'copy']); 58 59 grunt.registerTask('test-jquery', ['default', 'exec:test-jquery']); 60 grunt.registerTask('test-require', ['default', 'browserify', 'exec:test-require']); 61 grunt.registerTask('test', ['test-jquery', 'test-require']); 62 }; 63