Home | History | Annotate | Download | only in poly
      1 module.exports = function(grunt) {
      2 
      3   // Project configuration.
      4   grunt.initConfig({
      5     pkg: grunt.file.readJSON('package.json'),
      6     // Install all the packages listed in the bower.json file.
      7     shell: {
      8       bower_install: {
      9          command: 'bower install'
     10       }
     11     },
     12     // Copy all the bower files into a single directory.
     13     bower: {
     14       dev: {
     15         dest: '../../../out/grunt/third_party'
     16       }
     17     },
     18     // Concatenate all the files in third_party into a single file.
     19     concat: {
     20       dist: {
     21         src: [
     22           '../../../out/grunt/third_party/WeakMap.js',
     23           '../../../out/grunt/third_party/classlist.js',
     24           '../../../out/grunt/third_party/pointerevents-polyfill.js',
     25           '../../../out/grunt/third_party/MutationObserver.js',
     26           '../../../out/grunt/third_party/CustomElements.js',
     27           '../../../out/grunt/third_party/HTMLImports.js',
     28         ],
     29         dest: '../../../out/grunt/src/<%= pkg.name %>.js'
     30       }
     31     },
     32     // Uglify the one big file into one smaller file.
     33     uglify: {
     34       options: {
     35         banner: '/*! <%= pkg.name %> built from /exerimental/webtry/poly <%= grunt.template.today("yyyy-mm-dd") %> */\n'
     36       },
     37       build: {
     38         src: '../../../out/grunt/src/<%= pkg.name %>.js',
     39         dest: '../res/js/<%= pkg.name %>.js'
     40       }
     41     },
     42     copy: {
     43       simple: {
     44         src: '../../../out/grunt/src/<%= pkg.name %>.js',
     45         dest: '../res/js/<%= pkg.name %>.js'
     46       }
     47     }
     48   });
     49 
     50   // Load the plugins for the above commands.
     51   grunt.loadNpmTasks('grunt-bower');
     52   grunt.loadNpmTasks('grunt-contrib-concat');
     53   grunt.loadNpmTasks('grunt-contrib-copy');
     54   grunt.loadNpmTasks('grunt-contrib-cssmin');
     55   grunt.loadNpmTasks('grunt-contrib-uglify');
     56   grunt.loadNpmTasks('grunt-shell');
     57 
     58   // By default run all the commands in the right sequence to build our custom minified polyfill.
     59   grunt.registerTask('default', ['shell:bower_install', 'bower', 'concat', 'uglify']);
     60 
     61   // A target to build an unminified version, for debugging.
     62   grunt.registerTask('notmin', ['shell:bower_install', 'bower', 'concat', 'copy:simple']);
     63 
     64 };
     65