<commit_before>module.exports = function(grunt) {

  // Project config
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),

    // start "bowercopy" task
    bowercopy: {

      /*
       * don"t send messages to saying that Bower components aren"t
       * configured...ignore them instead. Also, don"t run any bower
       * tasks when grunt runs this task.
       */
      options: {
        ignore: ["gulp", "jquery"],
        runBower: false
      },

      // Copy Bootstrap CCS over
      bscss: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "css-build/"
        },
        files: {
          "bootstrap.css": "bootstrap/dist/css/bootstrap.css"
        }
      }, // end "bowercopy:bscss" task

      // Copy jQuery over
      cycle2: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.cycle2.min.js": "jquery-cycle2/build/jquery.cycle2.min.js",
          "jquery.cycle2.swipe.js": "jquery-cycle2/src/jquery.cycle2.swipe.js"
        }
      }, // end "bowercopy:jq" task

      // Copy jQuery over
      jq: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.min.js": "jquery/dist/jquery.min.js"
        }
      }, // end "bowercopy:jq" task

      // Copy scrollNav over
      scroll: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.scrollNav.min.js": "scrollNav/dist/jquery.scrollNav.min.js"
        }
      }, // end "bowercopy:jq" task

      // Copy enquire.js over
      enquire: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "enquire.min.js": "enquire/dist/enquire.min.js"
        }
      }, // end "bowercopy:enquire" task

      // Copy matchMedia.js over
      matchmedia: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "matchMedia.js": "matchmedia/matchMedia.js"
        }
      } // end "bowercopy:matchmedia" task
    }, // end "bowercopy" task

    // start "coffee" task
    coffee: {
      compile: {
        options: {
          bare: true
        },
        files: {
          // compile & concat .coffee files to a single file called
          // "build/js/main.js"
          "build/js/main.js": [
                                "coffee/common.coffee",
                                "coffee/enquire.coffee",
                                "coffee/popup-animation.coffee",
                                "coffee/scrollNav.coffee",
                                "coffee/players.coffee",
                                "coffee/swipeDetect.coffee"
                              ]
        }
      }
    }, // end "coffee" task

    shell: {
      lessCoreBuild: {
        command: "lessc css-build/styles.less > css-build/styles.css"
      }
    }
  });

  grunt.loadNpmTasks("grunt-bowercopy");
  grunt.loadNpmTasks("grunt-contrib-coffee");
  grunt.loadNpmTasks("grunt-shell");

};
<commit_msg>remove "coffee/swipeDetect.coffee"<commit_after>module.exports = function(grunt) {

  // Project config
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),

    // start "bowercopy" task
    bowercopy: {

      /*
       * don"t send messages to saying that Bower components aren"t
       * configured...ignore them instead. Also, don"t run any bower
       * tasks when grunt runs this task.
       */
      options: {
        ignore: ["gulp", "jquery"],
        runBower: false
      },

      // Copy Bootstrap CCS over
      bscss: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "css-build/"
        },
        files: {
          "bootstrap.css": "bootstrap/dist/css/bootstrap.css"
        }
      }, // end "bowercopy:bscss" task

      // Copy jQuery over
      cycle2: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.cycle2.min.js": "jquery-cycle2/build/jquery.cycle2.min.js",
          "jquery.cycle2.swipe.js": "jquery-cycle2/src/jquery.cycle2.swipe.js"
        }
      }, // end "bowercopy:jq" task

      // Copy jQuery over
      jq: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.min.js": "jquery/dist/jquery.min.js"
        }
      }, // end "bowercopy:jq" task

      // Copy scrollNav over
      scroll: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "jquery.scrollNav.min.js": "scrollNav/dist/jquery.scrollNav.min.js"
        }
      }, // end "bowercopy:jq" task

      // Copy enquire.js over
      enquire: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "enquire.min.js": "enquire/dist/enquire.min.js"
        }
      }, // end "bowercopy:enquire" task

      // Copy matchMedia.js over
      matchmedia: {

        // copy to the "css-build" directory
        options: {
          destPrefix: "build/js/libs/"
        },
        files: {
          "matchMedia.js": "matchmedia/matchMedia.js"
        }
      } // end "bowercopy:matchmedia" task
    }, // end "bowercopy" task

    // start "coffee" task
    coffee: {
      compile: {
        options: {
          bare: true
        },
        files: {
          // compile & concat .coffee files to a single file called
          // "build/js/main.js"
          "build/js/main.js": [
                                "coffee/common.coffee",
                                "coffee/enquire.coffee",
                                "coffee/popup-animation.coffee",
                                "coffee/scrollNav.coffee",
                                "coffee/players.coffee"
                              ]
        }
      }
    }, // end "coffee" task

    shell: {
      lessCoreBuild: {
        command: "lessc css-build/styles.less > css-build/styles.css"
      }
    }
  });

  grunt.loadNpmTasks("grunt-bowercopy");
  grunt.loadNpmTasks("grunt-contrib-coffee");
  grunt.loadNpmTasks("grunt-shell");

};
<|endoftext|>


<commit_before>// Generated on 2014-06-10 using generator-angular 0.9.0-0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  function connectAngularMiddleware (connect, options) {
    // based on http://stackoverflow.com/a/20553608/2486196
    var middlewares = [];

    // enable Angular's HTML5 mode
    middlewares.push(function (req, res, next) {
      var exists = false;
      var file = req.url.split('?')[0];

      for(var i = 0; i < options.base.length; i++) {
        if(require('fs').existsSync(options.base[i] + file)) {
          exists = true;
          break;
        }
      }

      if(!exists) {
        res.setHeader('Location', '/');
        req.url = '/';
      }

      next();
    });

    if (!Array.isArray(options.base)) {
      options.base = [options.base];
    }
    options.base.forEach(function(base) {
      // Serve static files.
      middlewares.push(connect.static(base));
    });

    return middlewares;
  }

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        middleware: connectAngularMiddleware,
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        exclude: [ /handlebars/, /fira/ ],
        ignorePath: new RegExp('^<%= yeoman.app %>/')
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    nunjucks: {
      osftemplates: {
        baseDir: '<%= yeoman.app %>/bower_components/osf-export-templates/tpls',
        src: '**/*.tpl',
        dest: '.tmp/scripts/osf-templates.js',
        options: {
          name: function(filename) {
            var format = filename.substr(0, filename.length - 4);
            return "osf_" + format;
          }
        }
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          cwd: '<%= yeoman.app %>/bower_components/fira',
          dest: '<%= yeoman.dist %>/fonts/fira',
          expand: true,
          src: [ '**/*.{eot,otf,ttf,woff}', ]
        }]
      },
      fonts: {
        files: [{
          cwd: '<%= yeoman.app %>/bower_components/fira',
          dest: '.tmp/fonts/fira',
          expand: true,
          src: [ '**/*.{eot,otf,ttf,woff}', ]
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'copy:fonts',
      'nunjucks:osftemplates',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'handlebars:exporttemplates',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>use nunjucks in build<commit_after>// Generated on 2014-06-10 using generator-angular 0.9.0-0
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  function connectAngularMiddleware (connect, options) {
    // based on http://stackoverflow.com/a/20553608/2486196
    var middlewares = [];

    // enable Angular's HTML5 mode
    middlewares.push(function (req, res, next) {
      var exists = false;
      var file = req.url.split('?')[0];

      for(var i = 0; i < options.base.length; i++) {
        if(require('fs').existsSync(options.base[i] + file)) {
          exists = true;
          break;
        }
      }

      if(!exists) {
        res.setHeader('Location', '/');
        req.url = '/';
      }

      next();
    });

    if (!Array.isArray(options.base)) {
      options.base = [options.base];
    }
    options.base.forEach(function(base) {
      // Serve static files.
      middlewares.push(connect.static(base));
    });

    return middlewares;
  }

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        middleware: connectAngularMiddleware,
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        exclude: [ /handlebars/, /fira/ ],
        ignorePath: new RegExp('^<%= yeoman.app %>/')
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    nunjucks: {
      osftemplates: {
        baseDir: '<%= yeoman.app %>/bower_components/osf-export-templates/tpls',
        src: '**/*.tpl',
        dest: '.tmp/scripts/osf-templates.js',
        options: {
          name: function(filename) {
            var format = filename.substr(0, filename.length - 4);
            return "osf_" + format;
          }
        }
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          cwd: '<%= yeoman.app %>/bower_components/fira',
          dest: '<%= yeoman.dist %>/fonts/fira',
          expand: true,
          src: [ '**/*.{eot,otf,ttf,woff}', ]
        }]
      },
      fonts: {
        files: [{
          cwd: '<%= yeoman.app %>/bower_components/fira',
          dest: '.tmp/fonts/fira',
          expand: true,
          src: [ '**/*.{eot,otf,ttf,woff}', ]
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'copy:fonts',
      'nunjucks:osftemplates',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'nunjucks:osftemplates',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<|endoftext|>


<commit_before>/*global module:false*/
module.exports = function(grunt) {
	// Load grunt helpers
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-csslint');
	grunt.loadNpmTasks('grunt-replace');

	// Project configuration.
	grunt.initConfig({
		// Package properties
		pkg: grunt.file.readJSON('package.json'),

		// So meta...
		meta: {
			banners: {
				full: '/*\n * <%= pkg.title || pkg.name %> - @@vVERSION\n' +
					' * <%=pkg.homepage%>\n' +
					' *\n' +
					' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
					' * Released under the <%= _.pluck(pkg.licenses, "type").join(", ") %> licenses\n' +
					' * http://jquery.org/license\n' +
					' *\n' +
					' * Date: <%= grunt.template.today("ddd mmm d yyyy hh:MM Zo", true) %>\n' +
					'@@BUILDPROPS */\n',

				uglify:'/* <%= pkg.name %> @@vVERSION @@PLUGINS | <%= pkg.homepage.replace("http://","") %> | '+
					'Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> | <%=grunt.template.today() %> */\n',

				cssmin:'/* <%= pkg.name %> @@vVERSION @@STYLES | <%= pkg.homepage.replace("http://","") %> | '+
					'Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> | <%=grunt.template.today() %> */'
			}
		},

		// Directories (dist changed in init())
		dirs: { src: 'src', dist: 'dist', libs: 'libs' },

		// Core files in order
		core: {
			js: [
				'<%=dirs.src%>/core/intro.js',
				'<%=dirs.src%>/core/constants.js',
				'<%=dirs.src%>/core/class.js',

				'<%=dirs.src%>/core/options.js',
				'<%=dirs.src%>/core/content.js',
				'<%=dirs.src%>/core/position.js',
				'<%=dirs.src%>/core/toggle.js',
				'<%=dirs.src%>/core/focus.js',
				'<%=dirs.src%>/core/disable.js',
				'<%=dirs.src%>/core/button.js',
				'<%=dirs.src%>/core/style.js',
				'<%=dirs.src%>/core/events.js',

				'<%=dirs.src%>/core/jquery_methods.js',
				'<%=dirs.src%>/core/jquery_overrides.js',

				'<%=dirs.src%>/core/defaults.js'
			],
			css: ['<%=dirs.src%>/core.css']
		},

		// Styles and plugins map
		styles: {
			basic: '<%=dirs.src%>/basic.css',
			css3: '<%=dirs.src%>/css3.css'
		},
		plugins: {
			tips: { js: '<%=dirs.src%>/tips/tips.js', css: '<%=dirs.src%>/tips/tips.css' },
			modal: { js: '<%=dirs.src%>/modal/modal.js', css: '<%=dirs.src%>/modal/modal.css' },
			viewport: { js: '<%=dirs.src%>/position/viewport.js' },
			svg: { js: [ '<%=dirs.src%>/position/polys.js', '<%=dirs.src%>/position/svg.js' ] },
			imagemap: { js: [ '<%=dirs.src%>/position/polys.js', '<%=dirs.src%>/position/imagemap.js' ] },
			ie6: { js: '<%=dirs.src%>/ie6/ie6.js', css: '<%=dirs.src%>/ie6/ie6.css' }
		},

		// Clean dist/ folder
		clean: ['<%=dirs.dist%>/*.*', '<%=dirs.dist%>/basic/*.*'],

		// Concatenation
		concat: {
			options: {
				stripBanners: true,
				separator: ';',
				banner: '<%=meta.banners.full%>'
			},
			dist: {
				// See "init" task for src
				dest: '<%=dirs.dist%>/jquery.qtip.js'
			},
			css: {
				// See "init" task for src
				options: { separator: '\n\n' },
				dest: '<%=dirs.dist%>/jquery.qtip.css'
			},
			libs: {
				options: {
					stripBanners: false,
					separator: '\n\n',
					banner: ''
				},
				files: {
					'<%=dirs.libs%>/imagesloaded/imagesloaded.pkg.js': [
						'<%=dirs.libs%>/imagesloaded/components/eventEmitter/EventEmitter.js',
						'<%=dirs.libs%>/imagesloaded/components/eventie/eventie.js',
						'<%=dirs.libs%>/imagesloaded/imagesloaded.js'
					]
				}
			}
		},

		// Minification
		uglify: {
			options: {
				preserveComments: 'some',
				banner: '<%=meta.banners.uglify%>',
				sourceMap: function(file) {
					return file.indexOf('imagesloaded') < 0 ? file.replace('.js', '.map') : null;
				},
				sourceMappingURL: function(file) {
					file = file.replace('dist/', '').replace('.js', '.map');

					return grunt.config('pkg.type') === 'stable' ?
						grunt.config.process('http://cdnjs.cloudflare.com/ajax/libs/qtip2/<%=pkg.version%>/') + file :
						'http://qtip2.com/v/nightly/' + file;
				}
			},
			dist: {
				files: {
					'<%=dirs.dist%>/jquery.qtip.min.js': ['<%=dirs.dist%>/jquery.qtip.js'],
					'<%=dirs.dist%>/imagesloaded.pkg.min.js': ['<%=dirs.libs%>/imagesloaded/imagesloaded.pkg.js']
				}
			}
		},
		cssmin: {
			options: {
				keepSpecialComments: 0,
				banner: '<%=meta.banners.cssmin%>'
			},
			dist: {
				files: {
					'<%=dirs.dist%>/jquery.qtip.min.css': '<%=dirs.dist%>/jquery.qtip.css'
				}
			}
		},

		replace: {
			dist: {
				files: [
					 { expand: true, flatten: true, src: ['<%=dirs.dist%>/**/*'], dest: '<%=dirs.dist%>/' }
				]
			}
		},

		// Linting
		csslint: {
			options: {
				'empty-rules': false,
				important: false,
				ids: false
			},
			strict: {
				src: ['<%=dirs.src%>/**/*.css']
			}
		},
		jshint: {
			options: {
				strict: false,
				curly: true,
				eqeqeq: true,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				boss: true,
				eqnull: true,
				browser: true,
				undef: true,
				expr: true,
				globals: {
					console: true, jQuery: true, '$': true, QTip: true, TRUE: true, FALSE: true, NULL: true,
					WIDTH: true, HEIGHT: true, TOP: true, LEFT: true, BOTTOM: true, RIGHT: true, X: true, Y: true,
					CENTER: true, FLIP: true, FLIPINVERT: true, SHIFT: true, QTIP: true,  PROTOTYPE: true,
					CORNER: true,  CHECKS: true, PLUGINS: true, NAMESPACE: true, ATTR_HAS: true, ATTR_ID: true,
					WIDGET: true, SELECTOR: true, INACTIVE_EVENTS: true, CLASS_FIXED: true, CLASS_DEFAULT: true,
					CLASS_FOCUS: true, CLASS_HOVER: true, CLASS_DISABLED: true, replaceSuffix: true, oldtitle: true,
					trackingBound: true, BROWSER: true, createWidgetClass: true, sanitizeOptions: true, cloneEvent: true,

				}
			},
			beforeconcat: [
				'grunt.js', '<%=dirs.src%>/*/*.js',
				'!<%=dirs.src%>/*/intro.js', '!<%=dirs.src%>/*/outro.js' // Ignore intro/outro files
			]
		}
	});

	// Parse command line options
	grunt.registerTask('init', 'Initialise build configuration.', function(basic) {
		// Grab command-line options, using valid defaults if not given
		var done = this.async(),
			stable = grunt.option('stable') === true,
			plugins = (grunt.option('plugins') || Object.keys( grunt.config('plugins')).join(' ')).replace(/ /g, ' ').split(' '),
			styles = (grunt.option('styles') || Object.keys( grunt.config('styles')).join(' ')).replace(/ /g, ' ').split(' '),
			valid, lib;

		// Ensure all git modules are checked out
		String(grunt.file.read('.gitmodules')).match(/\[submodule "libs\/[^\"]+"\]/g).forEach(function(lib) {
			if(!grunt.file.exists( lib.replace(/\[submodule "([^\"]+)"\]/g, '$1') ) ) {
				throw new Error('Can\'t locate all libs/ dependancies... please run "git module init" then "git module update"');
			}
		});

		// Setup JS/CSS arrays
		var js = grunt.config('core.js'),
			css = grunt.config('core.css'),
			dist = grunt.option('dist') || 'dist';

		// If basic... go into dist/basic
		if(basic) { dist += '/basic'; }

		// Parse 'dist' option (decides which directory to build into)
		grunt.config('dirs.dist', dist);

		// Parse 'styles' option (decides which stylesheets are included)
		if(!basic && grunt.option('styles') !== 0) {
			styles.forEach(function(style, i) {
				if( (valid = grunt.config('styles.'+style)) ) {
					css.push(valid);
				}
				else { styles[i] = style+('*'.red); }
			});
		}
		else { styles = ['None']; }

		// Parse 'plugins' option (decides which plugins are included)
		if(!basic && grunt.option('plugins') !== 0) {
			plugins.forEach(function(plugin, i) {
				if( (valid = grunt.config('plugins.'+plugin)) ) {
					if(valid.js) { js.push(valid.js); }
					if(valid.css) { css.push(valid.css); }
				}
				else { plugins[i] = plugin+('*'.red); }
			});
		}
		else { plugins = ['None']; }

		// Add outro
		js.push('<%=dirs.src%>/core/outro.js');

		// Update concatenation config
		grunt.config('concat.dist.src', js);
		grunt.config('concat.css.src', css);

		// Setup in-file text replacements (version, date etc)
		grunt.util.spawn({ cmd: 'git', args: ['describe'] }, function(err, data) {
			// Ensure it succeed
			if(data.code > 1) {
				grunt.log.write('Uhoh... couldn\'t grab Git repository description. Somethings up!');
				return done();
			}

			// Determine version
			var version = stable ?
				grunt.config('pkg.version') :
				grunt.config('pkg.version', data.stdout.substr(0,10) );

			// Set version type config
			grunt.config('pkg.type', stable ? 'stable' : 'nightly');

			// Setup styles and plugins replacements arrays
			var strStyles = styles.length ? styles.join(' ') : '';
				strPlugins = plugins.length ? plugins.join(' ') : '';

			// Setup build properties
			var buildprops = (plugins.length ? ' * Plugins: '+strPlugins+'\n' : '') +
				(styles.length ? ' * Styles: '+strStyles+'\n' : '');

			// Setup minification build properties
			var minbuildprops = plugins[0] !== 'None' || styles[0] !== 'None' ?
				'(includes: ' +
					(plugins[0] !== 'None' ? strPlugins : '') +
					(styles[0] !== 'None' ? ' / ' + strStyles : '') + ') '
				: '';

			// Set replacement variables
			grunt.config('replace.dist.options.variables', {
				'BUILDPROPS': buildprops,
				'MINBUILDPROPS': minbuildprops,
				'VERSION': stable ? version : version.substr(1),
				'vVERSION': stable ? 'v'+version : version,
				'DATE': grunt.template.today("dd-mm-yyyy"),
				'STYLES': strStyles,
				'PLUGINS': strPlugins
			});

			// Output current build properties
			grunt.log.write("\nBuilding " + "qTip2".green + " "+version+" with " +
				"plugins " + plugins.join(' ').green + " and " +
				"styles "  +styles.join(' ').green + "\n"
			);

			// Async task done
			done(version);
		});
	});

	var defaultTasks = ['concat', 'uglify', 'cssmin', 'replace'];

	// Setup tasks
	grunt.registerTask('basic', ['init:basic', 'clean'].concat(defaultTasks));
	grunt.registerTask('default', ['init', 'clean'].concat(defaultTasks));
	grunt.registerTask('dev', ['init', 'clean', 'jshint', 'csslint'].concat(defaultTasks));
	grunt.registerTask('css', ['init', 'clean', 'csslint', 'concat:css', 'cssmin', 'replace']);
	grunt.registerTask('all', ['init', 'clean'].concat(defaultTasks).concat(['init:basic']).concat(defaultTasks));
};
<commit_msg>Fix bower path<commit_after>/*global module:false*/
module.exports = function(grunt) {
	// Load grunt helpers
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-csslint');
	grunt.loadNpmTasks('grunt-replace');

	// Project configuration.
	grunt.initConfig({
		// Package properties
		pkg: grunt.file.readJSON('package.json'),

		// So meta...
		meta: {
			banners: {
				full: '/*\n * <%= pkg.title || pkg.name %> - @@vVERSION\n' +
					' * <%=pkg.homepage%>\n' +
					' *\n' +
					' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
					' * Released under the <%= _.pluck(pkg.licenses, "type").join(", ") %> licenses\n' +
					' * http://jquery.org/license\n' +
					' *\n' +
					' * Date: <%= grunt.template.today("ddd mmm d yyyy hh:MM Zo", true) %>\n' +
					'@@BUILDPROPS */\n',

				uglify:'/* <%= pkg.name %> @@vVERSION @@PLUGINS | <%= pkg.homepage.replace("http://","") %> | '+
					'Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> | <%=grunt.template.today() %> */\n',

				cssmin:'/* <%= pkg.name %> @@vVERSION @@STYLES | <%= pkg.homepage.replace("http://","") %> | '+
					'Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> | <%=grunt.template.today() %> */'
			}
		},

		// Directories (dist changed in init())
		dirs: { src: 'src', dist: 'dist', libs: 'libs' },

		// Core files in order
		core: {
			js: [
				'<%=dirs.src%>/core/intro.js',
				'<%=dirs.src%>/core/constants.js',
				'<%=dirs.src%>/core/class.js',

				'<%=dirs.src%>/core/options.js',
				'<%=dirs.src%>/core/content.js',
				'<%=dirs.src%>/core/position.js',
				'<%=dirs.src%>/core/toggle.js',
				'<%=dirs.src%>/core/focus.js',
				'<%=dirs.src%>/core/disable.js',
				'<%=dirs.src%>/core/button.js',
				'<%=dirs.src%>/core/style.js',
				'<%=dirs.src%>/core/events.js',

				'<%=dirs.src%>/core/jquery_methods.js',
				'<%=dirs.src%>/core/jquery_overrides.js',

				'<%=dirs.src%>/core/defaults.js'
			],
			css: ['<%=dirs.src%>/core.css']
		},

		// Styles and plugins map
		styles: {
			basic: '<%=dirs.src%>/basic.css',
			css3: '<%=dirs.src%>/css3.css'
		},
		plugins: {
			tips: { js: '<%=dirs.src%>/tips/tips.js', css: '<%=dirs.src%>/tips/tips.css' },
			modal: { js: '<%=dirs.src%>/modal/modal.js', css: '<%=dirs.src%>/modal/modal.css' },
			viewport: { js: '<%=dirs.src%>/position/viewport.js' },
			svg: { js: [ '<%=dirs.src%>/position/polys.js', '<%=dirs.src%>/position/svg.js' ] },
			imagemap: { js: [ '<%=dirs.src%>/position/polys.js', '<%=dirs.src%>/position/imagemap.js' ] },
			ie6: { js: '<%=dirs.src%>/ie6/ie6.js', css: '<%=dirs.src%>/ie6/ie6.css' }
		},

		// Clean dist/ folder
		clean: ['<%=dirs.dist%>/*.*', '<%=dirs.dist%>/basic/*.*'],

		// Concatenation
		concat: {
			options: {
				stripBanners: true,
				separator: ';',
				banner: '<%=meta.banners.full%>'
			},
			dist: {
				// See "init" task for src
				dest: '<%=dirs.dist%>/jquery.qtip.js'
			},
			css: {
				// See "init" task for src
				options: { separator: '\n\n' },
				dest: '<%=dirs.dist%>/jquery.qtip.css'
			},
			libs: {
				options: {
					stripBanners: false,
					separator: '\n\n',
					banner: ''
				},
				files: {
					'<%=dirs.libs%>/imagesloaded/imagesloaded.pkg.js': [
						'<%=dirs.libs%>/imagesloaded/bower_components/eventEmitter/EventEmitter.js',
						'<%=dirs.libs%>/imagesloaded/bower_components/eventie/eventie.js',
						'<%=dirs.libs%>/imagesloaded/imagesloaded.js'
					]
				}
			}
		},

		// Minification
		uglify: {
			options: {
				preserveComments: 'some',
				banner: '<%=meta.banners.uglify%>',
				sourceMap: function(file) {
					return file.indexOf('imagesloaded') < 0 ? file.replace('.js', '.map') : null;
				},
				sourceMappingURL: function(file) {
					file = file.replace('dist/', '').replace('.js', '.map');

					return grunt.config('pkg.type') === 'stable' ?
						grunt.config.process('http://cdnjs.cloudflare.com/ajax/libs/qtip2/<%=pkg.version%>/') + file :
						'http://qtip2.com/v/nightly/' + file;
				}
			},
			dist: {
				files: {
					'<%=dirs.dist%>/jquery.qtip.min.js': ['<%=dirs.dist%>/jquery.qtip.js'],
					'<%=dirs.dist%>/imagesloaded.pkg.min.js': ['<%=dirs.libs%>/imagesloaded/imagesloaded.pkg.js']
				}
			}
		},
		cssmin: {
			options: {
				keepSpecialComments: 0,
				banner: '<%=meta.banners.cssmin%>'
			},
			dist: {
				files: {
					'<%=dirs.dist%>/jquery.qtip.min.css': '<%=dirs.dist%>/jquery.qtip.css'
				}
			}
		},

		replace: {
			dist: {
				files: [
					 { expand: true, flatten: true, src: ['<%=dirs.dist%>/**/*'], dest: '<%=dirs.dist%>/' }
				]
			}
		},

		// Linting
		csslint: {
			options: {
				'empty-rules': false,
				important: false,
				ids: false
			},
			strict: {
				src: ['<%=dirs.src%>/**/*.css']
			}
		},
		jshint: {
			options: {
				strict: false,
				curly: true,
				eqeqeq: true,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				boss: true,
				eqnull: true,
				browser: true,
				undef: true,
				expr: true,
				globals: {
					console: true, jQuery: true, '$': true, QTip: true, TRUE: true, FALSE: true, NULL: true,
					WIDTH: true, HEIGHT: true, TOP: true, LEFT: true, BOTTOM: true, RIGHT: true, X: true, Y: true,
					CENTER: true, FLIP: true, FLIPINVERT: true, SHIFT: true, QTIP: true,  PROTOTYPE: true,
					CORNER: true,  CHECKS: true, PLUGINS: true, NAMESPACE: true, ATTR_HAS: true, ATTR_ID: true,
					WIDGET: true, SELECTOR: true, INACTIVE_EVENTS: true, CLASS_FIXED: true, CLASS_DEFAULT: true,
					CLASS_FOCUS: true, CLASS_HOVER: true, CLASS_DISABLED: true, replaceSuffix: true, oldtitle: true,
					trackingBound: true, BROWSER: true, createWidgetClass: true, sanitizeOptions: true, cloneEvent: true,

				}
			},
			beforeconcat: [
				'grunt.js', '<%=dirs.src%>/*/*.js',
				'!<%=dirs.src%>/*/intro.js', '!<%=dirs.src%>/*/outro.js' // Ignore intro/outro files
			]
		}
	});

	// Parse command line options
	grunt.registerTask('init', 'Initialise build configuration.', function(basic) {
		// Grab command-line options, using valid defaults if not given
		var done = this.async(),
			stable = grunt.option('stable') === true,
			plugins = (grunt.option('plugins') || Object.keys( grunt.config('plugins')).join(' ')).replace(/ /g, ' ').split(' '),
			styles = (grunt.option('styles') || Object.keys( grunt.config('styles')).join(' ')).replace(/ /g, ' ').split(' '),
			valid, lib;

		// Ensure all git modules are checked out
		String(grunt.file.read('.gitmodules')).match(/\[submodule "libs\/[^\"]+"\]/g).forEach(function(lib) {
			if(!grunt.file.exists( lib.replace(/\[submodule "([^\"]+)"\]/g, '$1') ) ) {
				throw new Error('Can\'t locate all libs/ dependancies... please run "git module init" then "git module update"');
			}
		});

		// Setup JS/CSS arrays
		var js = grunt.config('core.js'),
			css = grunt.config('core.css'),
			dist = grunt.option('dist') || 'dist';

		// If basic... go into dist/basic
		if(basic) { dist += '/basic'; }

		// Parse 'dist' option (decides which directory to build into)
		grunt.config('dirs.dist', dist);

		// Parse 'styles' option (decides which stylesheets are included)
		if(!basic && grunt.option('styles') !== 0) {
			styles.forEach(function(style, i) {
				if( (valid = grunt.config('styles.'+style)) ) {
					css.push(valid);
				}
				else { styles[i] = style+('*'.red); }
			});
		}
		else { styles = ['None']; }

		// Parse 'plugins' option (decides which plugins are included)
		if(!basic && grunt.option('plugins') !== 0) {
			plugins.forEach(function(plugin, i) {
				if( (valid = grunt.config('plugins.'+plugin)) ) {
					if(valid.js) { js.push(valid.js); }
					if(valid.css) { css.push(valid.css); }
				}
				else { plugins[i] = plugin+('*'.red); }
			});
		}
		else { plugins = ['None']; }

		// Add outro
		js.push('<%=dirs.src%>/core/outro.js');

		// Update concatenation config
		grunt.config('concat.dist.src', js);
		grunt.config('concat.css.src', css);

		// Setup in-file text replacements (version, date etc)
		grunt.util.spawn({ cmd: 'git', args: ['describe'] }, function(err, data) {
			// Ensure it succeed
			if(data.code > 1) {
				grunt.log.write('Uhoh... couldn\'t grab Git repository description. Somethings up!');
				return done();
			}

			// Determine version
			var version = stable ?
				grunt.config('pkg.version') :
				grunt.config('pkg.version', data.stdout.substr(0,10) );

			// Set version type config
			grunt.config('pkg.type', stable ? 'stable' : 'nightly');

			// Setup styles and plugins replacements arrays
			var strStyles = styles.length ? styles.join(' ') : '';
				strPlugins = plugins.length ? plugins.join(' ') : '';

			// Setup build properties
			var buildprops = (plugins.length ? ' * Plugins: '+strPlugins+'\n' : '') +
				(styles.length ? ' * Styles: '+strStyles+'\n' : '');

			// Setup minification build properties
			var minbuildprops = plugins[0] !== 'None' || styles[0] !== 'None' ?
				'(includes: ' +
					(plugins[0] !== 'None' ? strPlugins : '') +
					(styles[0] !== 'None' ? ' / ' + strStyles : '') + ') '
				: '';

			// Set replacement variables
			grunt.config('replace.dist.options.variables', {
				'BUILDPROPS': buildprops,
				'MINBUILDPROPS': minbuildprops,
				'VERSION': stable ? version : version.substr(1),
				'vVERSION': stable ? 'v'+version : version,
				'DATE': grunt.template.today("dd-mm-yyyy"),
				'STYLES': strStyles,
				'PLUGINS': strPlugins
			});

			// Output current build properties
			grunt.log.write("\nBuilding " + "qTip2".green + " "+version+" with " +
				"plugins " + plugins.join(' ').green + " and " +
				"styles "  +styles.join(' ').green + "\n"
			);

			// Async task done
			done(version);
		});
	});

	var defaultTasks = ['concat', 'uglify', 'cssmin', 'replace'];

	// Setup tasks
	grunt.registerTask('basic', ['init:basic', 'clean'].concat(defaultTasks));
	grunt.registerTask('default', ['init', 'clean'].concat(defaultTasks));
	grunt.registerTask('dev', ['init', 'clean', 'jshint', 'csslint'].concat(defaultTasks));
	grunt.registerTask('css', ['init', 'clean', 'csslint', 'concat:css', 'cssmin', 'replace']);
	grunt.registerTask('all', ['init', 'clean'].concat(defaultTasks).concat(['init:basic']).concat(defaultTasks));
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
// Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %> */ \n',
    concat: {
      prod: {
        src: ['app/lib/*.js', 'app/lib/**/*.js', 'app/*.js' ],
        dest: 'customforms.js',
        banner: '<%= banner %>',
        stripBanners: true
      },
      test: {
        src: 'test/specs/**/*.js',
        dest: 'test/tests.js',
        banner: '<%= banner %>',
        stripBanners: false
      },
      dev: {
        src: '<%= concat.prod.src %>',
        dest: 'demo/customforms.js',
        banner: '<%= banner %>',
        stripBanners: false
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>',
        separtor: ';'
      },
      dist: {
        src: '<%= concat.prod.dest %>',
        dest: 'customforms.<%= pkg.version %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
            module: false,
            $: false
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['app/lib/**/*.js','app/app/**/*.js', 'app/*.js']
      }
    },
    qunit: {
        all: ['test/**/*.html']
    },
    docco: {
      all: {
          src: ['<%= concat.prod.dest %>'],
          dest: 'doc/'
      }
    },
    watch: {
      js: {
          files: ['<%= concat.prod.src %>'],
          tasks: ['concat:dev']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'test']
      },
      dev_test: {
        files: 'test/specs/**/*.js',
        tasks: ['concat:test', 'test']
      }
    },
    bowerful: {
        store: 'components',
        dest: 'demo',
        packages: {
            jquery: ''
        }
    },
    clean: {
        install: {
            src: '<%= bowerful.store.src %>'
        }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-bowerful');

  // Better naming conventions
  grunt.registerTask('lint', 'Lint javascript files with default validator', 'jshint');
  grunt.registerTask('min',  'Minify files with default minifier', 'uglify');
  grunt.registerTask('utest', 'Unit testing on the command line with default testing framework', ['concat:test', 'qunit']);
  grunt.registerTask('dev', 'Watch javascript files and rebuild', 'watch:js');

  // docco
  grunt.loadNpmTasks('grunt-docco');

  // install
  grunt.registerTask('install', 'Install javascript components defined on Gruntfile',  ['bowerful', 'clean:install']);

  // test
  grunt.registerTask('test', 'build and integration test', ['lint', 'utest']);

  // Default task.
  grunt.registerTask('default', ['jshint', 'test', 'concat', 'uglify']);

};
<commit_msg>updated grunt file to test travis<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %> */ \n',
    concat: {
      prod: {
        src: ['app/lib/*.js', 'app/lib/**/*.js', 'app/*.js' ],
        dest: 'customforms.js',
        banner: '<%= banner %>',
        stripBanners: true
      },
      test: {
        src: 'test/specs/**/*.js',
        dest: 'test/tests.js',
        banner: '<%= banner %>',
        stripBanners: false
      },
      dev: {
        src: '<%= concat.prod.src %>',
        dest: 'demo/customforms.js',
        banner: '<%= banner %>',
        stripBanners: false
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>',
        separtor: ';'
      },
      dist: {
        src: '<%= concat.prod.dest %>',
        dest: 'customforms.<%= pkg.version %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
            module: false,
            $: false
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['app/lib/**/*.js','app/app/**/*.js', 'app/*.js']
      }
    },
    qunit: {
        all: ['test/**/*.html']
    },
    docco: {
      all: {
          src: ['<%= concat.prod.dest %>'],
          dest: 'doc/'
      }
    },
    watch: {
      js: {
          files: ['<%= concat.prod.src %>'],
          tasks: ['concat:dev']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'test']
      },
      dev_test: {
        files: 'test/specs/**/*.js',
        tasks: ['concat:test', 'test']
      }
    },
    bowerful: {
        store: 'components',
        dest: 'demo',
        packages: {
            jquery: ''
        }
    },
    clean: {
        install: {
            src: '<%= bowerful.store.src %>'
        }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-bowerful');

  // Better naming conventions
  grunt.registerTask('lint', 'Lint javascript files with default validator', 'jshint');
  grunt.registerTask('min',  'Minify files with default minifier', 'uglify');
  grunt.registerTask('utest', 'Unit testing on the command line with default testing framework', ['concat:test', 'qunit']);
  grunt.registerTask('dev', 'Watch javascript files and rebuild', 'watch:js');

  // docco
  grunt.loadNpmTasks('grunt-docco');

  // install
  grunt.registerTask('install', 'Install javascript components defined on Gruntfile',  ['bowerful', 'clean:install']);

  // test
  grunt.registerTask('test', 'build and integration test', ['lint', 'utest']);

  // Default task.
  grunt.registerTask('default', ['jshint', 'test', 'concat', 'uglify']);

};
<|endoftext|>


<commit_before>// Generated on 2015-05-21 using generator-angular 0.11.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      sass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git{,*/}*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      server: {
        options: {
          map: true,
        },
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    sass: {
      options: {
        includePaths: [
          'bower_components'
        ]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '!<%= yeoman.dist %>/images/ignore/*',
          '<%= yeoman.dist %>/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ]
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/{,*/}*.*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'sass:server',
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'sass',
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },

    // Surge
    surge: {
      'designkit': {
        options: {
          // The path to compiled project
          project: 'dist/',
          // The domain to deploy to
          domain: 'fancy-scale.surge.sh'
        }
      }
    }

  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'wiredep',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('deploy', [
    'surge'
  ]);

};
<commit_msg>Added images/assets to be ignored by the cache<commit_after>// Generated on 2015-05-21 using generator-angular 0.11.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      sass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git{,*/}*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      server: {
        options: {
          map: true,
        },
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    sass: {
      options: {
        includePaths: [
          'bower_components'
        ]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '!<%= yeoman.dist %>/images/ignore/*',
          '!<%= yeoman.dist %>/images/assets/*',
          '<%= yeoman.dist %>/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ]
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/{,*/}*.*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'sass:server',
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'sass',
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },

    // Surge
    surge: {
      'designkit': {
        options: {
          // The path to compiled project
          project: 'dist/',
          // The domain to deploy to
          domain: 'fancy-scale.surge.sh'
        }
      }
    }

  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'wiredep',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('deploy', [
    'surge'
  ]);

};
<|endoftext|>