<commit_before>'use strict';

module.exports = function (grunt) {

    // load all grunt tasks matching the `grunt-*` pattern
    require('load-grunt-tasks')(grunt);

    // Configurable paths
    var config = {
        src: 'src',
        dist: 'dist',
        temp: '.tmp'
    };

    var modRewrite = require('connect-modrewrite');

    var connectMiddleware = function (connect, options) {
        var middlewares = [];

        // Mod-rewrite for
        middlewares.push(modRewrite([
            '!api(.*)|cms(.*)|\/status(.*)|' +
            '\\.html|\\.js|\\.css|\\.jpg|\\.ico|\\.json|' +
            '\\.png|\\.gif|\\.pdf|\\.ttf|\\.otf|\\.xml$ /index.html [L]'
        ]));

        // Add base directories to middleware array
        var directory = options.directory || options.base[options.base.length - 1];
        if (!Array.isArray(options.base)) {
            options.base = [options.base];
        }

        options.base.forEach(function (base) {
            // Serve static files.
            middlewares.push(connect.static(base));
        });

        // Make directory browse-able.
        middlewares.push(connect.directory(directory));

        return middlewares;
    };

    grunt.initConfig({

        config: config,

        bower: {
            options: {
                cleanTargetDir: true,
                cleanBowerDir: false,
                copy: true,
                install: false
            },
            install: {
                options: {
                    targetDir: '<%= config.src %>/scripts/components'
                }
            }
        },

        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            server: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.temp %>'
                    ]
                }]
            },
            grunticon: {
                files: [{
                    src: [
                        '<%= config.src %>/images/icons-min/'
                    ]
                }]
            }
        },

        concat: {
            headScripts: {
                src: [
                    '<%= config.src %>/scripts/components/modernizr/modernizr.js',
                    '<%= config.src %>/scripts/grunticon.js'
                ],
                dest: '<%= config.dist %>/scripts/lorax-head.min.js'
            }
        },

        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
            server: {
                options: {
                    middleware: connectMiddleware,
                    base: ['<%= config.temp %>', '<%= config.src %>']
                }
            }
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= config.src %>',
                    dest: '<%= config.dist %>',
                    src: ['**'],
                    filter: 'isFile'
                    // src: [
                    //     '*.{ico,png,txt}',
                    //     '.htaccess',
                    //     'CNAME',
                    //     'robots.txt',
                    //     'scripts/data/{,*/}*.{js,json}',
                    //     'images/{,*/}*.{ico,gif,png,jpg,pdf,html}',
                    //     'fonts/{,*/}*.{otf,ttf,eot,woff,svg}',
                    //     'data/**/*.json',
                    //     '**/*.tpl.html',
                    //     'index.html'
                    // ]
                }]
            }
        },

        grunticon: {
            options: {
                customselectors:
                    grunt.file.readJSON('src/styles/grunticon/custom-selectors.json')
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-min/',
                    src: ['*.svg', '*.png'],
                    dest: '<%= config.dist %>/images/icons/'
                }]
            },
            server: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-min/',
                    src: ['*.svg', '*.png'],
                    dest: '<%= config.temp %>/images/icons/'
                }]
            }
        },

        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                '!Gruntfile.js',
                'app/**/*.js',
                '<%= config.src %>/scripts/{,*/}*.js',
                '!<%= config.src %>/scripts/libs/{,*/}*.js',
                '!<%= config.src %>/scripts/components/{,*/}*.js',
                '!<%= config.src %>/scripts/utils.js',
                '!bower_components/{,*/}*.js',
                '!node_modules/{,*/}*.js',
                '!**/grunticon.js'
            ]
        },

        less: {
            server: {
                options: {
                    paths: ['<%= config.src %>/styles']
                },
                files: {
                    '<%= config.temp %>/css/main.css': '<%= config.src %>/styles/main.less'
                }
            },
            dist: {
                options: {
                    cleancss: true,
                    paths: ['<%= config.src %>/styles']
                },
                files: {
                    '<%= config.dist %>/css/main.css': '<%= config.src %>/styles/main.less'
                }
            }
        },

        requirejs: {
            dist: {
                options: {
                    baseUrl: '<%= config.src %>/app',
                    mainConfigFile: '<%= config.src %>/scripts/config.js',
                    normalizeDirDefines: 'all',
                    out: '<%= config.temp %>/scripts/lorax.js',
                    preserveLicenseComments: false
                }
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-source',
                    src: ['*.svg'],
                    dest: '<%= config.src %>/images/icons-min'
                }]
            }
        },

        uglify: {
            options: {
                compress: {
                    /*jshint camelcase: false */
                    drop_console: true
                }
            },
            dist: {
                files: {
                    '<%= config.dist %>/scripts/lorax.min.js': [
                        '<%= config.temp %>/scripts/lorax.js'
                    ]
                }
            }
        },

        usemin: {
            html: ['<%= config.dist %>/{,*/}*.html'],
            //css: ['<%= config.temp %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= config.dist %>']
            }
        },

        useminPrepare: {
            html: '<%= config.src %>/index.html',
            options: {
                dest: '<%= config.dist %>'
            }
        },

        watch: {
            styles: {
                files: ['<%= config.src %>/styles/**/*.less'],
                tasks: [
                    'less:server',
                ]
            },
            grunticon: {
                files: [
                    '<%= config.src %>/images/icons-source/{,*/}*.svg',
                    '<%= config.src %>/styles/grunticon/custom-selectors.json'
                ],
                tasks: [
                    'clean:grunticon',
                    'svgmin',
                    'grunticon:server'
                ]
            },
            jshint: {
                files: ['<%= jshint.all %>'],
                tasks: ['jshint']
            }
        },

        'gh-pages': {
            options: {
                base: 'dist'
            },
            src: ['**']
        },

        s3: {
            options: {
                bucket: process.env.AWS_S3_BUCKET,
                access: 'public-read',
                headers: {
                    // Two Hour cache policy (1000 * 60 * 60 * 2)
                    'Cache-Control': 'max-age=7200, public',
                    'Expires': new Date(Date.now() + 7200000).toUTCString()
                }
            },
            prod: {
                upload: [
                    {
                        src: 'dist/**',
                        dest: '',
                        rel: 'dist',
                        options: {
                            verify: true,
                            gzip: true,
                            gzipExclude: ['.png', '.ico', '.txt', '.jpg', '.woff']
                        }
                    }
                ]
            }
        },
        compress: {
            main: {
                options: {
                    mode: 'gzip',
                    level: 9
                },
                expand: true,
                cwd: 'dist/',
                dest: 'dist/',
                src: [
                  '**/*.css',
                  '**/*.js',
                  '**/*.eot',
                  '**/*.svg',
                  '**/*.ttf'
                ]
            }
        }
    });

    grunt.registerTask('default', []);

    // Dev
    grunt.registerTask('server', function () {
        grunt.task.run([
            'clean:server',
            'clean:grunticon',
            'svgmin',
            'grunticon:server',
            'bower:install',
            'less:server',
            'connect:server',
            'watch'
        ]);
    });

    // Build
    grunt.registerTask('build', function () {
        grunt.task.run([
            'clean:dist',
            'clean:grunticon',
            'useminPrepare',
            'bower:install',
            'less:dist',
            'svgmin',
            'grunticon:dist',
            'copy:dist',
            'requirejs',
            'concat',
            'uglify:dist',
            'usemin'
            // 'compress:main'
        ]);
    });

    // Dev
    grunt.registerTask('icons', function () {
        grunt.task.run([
            'clean:grunticon',
            'svgmin',
            'grunticon:server',
        ]);
    });
};
<commit_msg>Reorder build to fix icons.<commit_after>'use strict';

module.exports = function (grunt) {

    // load all grunt tasks matching the `grunt-*` pattern
    require('load-grunt-tasks')(grunt);

    // Configurable paths
    var config = {
        src: 'src',
        dist: 'dist',
        temp: '.tmp'
    };

    var modRewrite = require('connect-modrewrite');

    var connectMiddleware = function (connect, options) {
        var middlewares = [];

        // Mod-rewrite for
        middlewares.push(modRewrite([
            '!api(.*)|cms(.*)|\/status(.*)|' +
            '\\.html|\\.js|\\.css|\\.jpg|\\.ico|\\.json|' +
            '\\.png|\\.gif|\\.pdf|\\.ttf|\\.otf|\\.xml$ /index.html [L]'
        ]));

        // Add base directories to middleware array
        var directory = options.directory || options.base[options.base.length - 1];
        if (!Array.isArray(options.base)) {
            options.base = [options.base];
        }

        options.base.forEach(function (base) {
            // Serve static files.
            middlewares.push(connect.static(base));
        });

        // Make directory browse-able.
        middlewares.push(connect.directory(directory));

        return middlewares;
    };

    grunt.initConfig({

        config: config,

        bower: {
            options: {
                cleanTargetDir: true,
                cleanBowerDir: false,
                copy: true,
                install: false
            },
            install: {
                options: {
                    targetDir: '<%= config.src %>/scripts/components'
                }
            }
        },

        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            server: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.temp %>'
                    ]
                }]
            },
            grunticon: {
                files: [{
                    src: [
                        '<%= config.src %>/images/icons-min/'
                    ]
                }]
            }
        },

        concat: {
            headScripts: {
                src: [
                    '<%= config.src %>/scripts/components/modernizr/modernizr.js',
                    '<%= config.src %>/scripts/grunticon.js'
                ],
                dest: '<%= config.dist %>/scripts/lorax-head.min.js'
            }
        },

        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
            server: {
                options: {
                    middleware: connectMiddleware,
                    base: ['<%= config.temp %>', '<%= config.src %>']
                }
            }
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= config.src %>',
                    dest: '<%= config.dist %>',
                    src: ['**'],
                    filter: 'isFile'
                    // src: [
                    //     '*.{ico,png,txt}',
                    //     '.htaccess',
                    //     'CNAME',
                    //     'robots.txt',
                    //     'scripts/data/{,*/}*.{js,json}',
                    //     'images/{,*/}*.{ico,gif,png,jpg,pdf,html}',
                    //     'fonts/{,*/}*.{otf,ttf,eot,woff,svg}',
                    //     'data/**/*.json',
                    //     '**/*.tpl.html',
                    //     'index.html'
                    // ]
                }]
            }
        },

        grunticon: {
            options: {
                customselectors:
                    grunt.file.readJSON('src/styles/grunticon/custom-selectors.json')
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-min/',
                    src: ['*.svg', '*.png'],
                    dest: '<%= config.dist %>/images/icons/'
                }]
            },
            server: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-min/',
                    src: ['*.svg', '*.png'],
                    dest: '<%= config.temp %>/images/icons/'
                }]
            }
        },

        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                '!Gruntfile.js',
                'app/**/*.js',
                '<%= config.src %>/scripts/{,*/}*.js',
                '!<%= config.src %>/scripts/libs/{,*/}*.js',
                '!<%= config.src %>/scripts/components/{,*/}*.js',
                '!<%= config.src %>/scripts/utils.js',
                '!bower_components/{,*/}*.js',
                '!node_modules/{,*/}*.js',
                '!**/grunticon.js'
            ]
        },

        less: {
            server: {
                options: {
                    paths: ['<%= config.src %>/styles']
                },
                files: {
                    '<%= config.temp %>/css/main.css': '<%= config.src %>/styles/main.less'
                }
            },
            dist: {
                options: {
                    cleancss: true,
                    paths: ['<%= config.src %>/styles']
                },
                files: {
                    '<%= config.dist %>/css/main.css': '<%= config.src %>/styles/main.less'
                }
            }
        },

        requirejs: {
            dist: {
                options: {
                    baseUrl: '<%= config.src %>/app',
                    mainConfigFile: '<%= config.src %>/scripts/config.js',
                    normalizeDirDefines: 'all',
                    out: '<%= config.temp %>/scripts/lorax.js',
                    preserveLicenseComments: false
                }
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.src %>/images/icons-source',
                    src: ['*.svg'],
                    dest: '<%= config.src %>/images/icons-min'
                }]
            }
        },

        uglify: {
            options: {
                compress: {
                    /*jshint camelcase: false */
                    drop_console: true
                }
            },
            dist: {
                files: {
                    '<%= config.dist %>/scripts/lorax.min.js': [
                        '<%= config.temp %>/scripts/lorax.js'
                    ]
                }
            }
        },

        usemin: {
            html: ['<%= config.dist %>/{,*/}*.html'],
            //css: ['<%= config.temp %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= config.dist %>']
            }
        },

        useminPrepare: {
            html: '<%= config.src %>/index.html',
            options: {
                dest: '<%= config.dist %>'
            }
        },

        watch: {
            styles: {
                files: ['<%= config.src %>/styles/**/*.less'],
                tasks: [
                    'less:server',
                ]
            },
            grunticon: {
                files: [
                    '<%= config.src %>/images/icons-source/{,*/}*.svg',
                    '<%= config.src %>/styles/grunticon/custom-selectors.json'
                ],
                tasks: [
                    'clean:grunticon',
                    'svgmin',
                    'grunticon:server'
                ]
            },
            jshint: {
                files: ['<%= jshint.all %>'],
                tasks: ['jshint']
            }
        },

        'gh-pages': {
            options: {
                base: 'dist'
            },
            src: ['**']
        },

        s3: {
            options: {
                bucket: process.env.AWS_S3_BUCKET,
                access: 'public-read',
                headers: {
                    // Two Hour cache policy (1000 * 60 * 60 * 2)
                    'Cache-Control': 'max-age=7200, public',
                    'Expires': new Date(Date.now() + 7200000).toUTCString()
                }
            },
            prod: {
                upload: [
                    {
                        src: 'dist/**',
                        dest: '',
                        rel: 'dist',
                        options: {
                            verify: true,
                            gzip: true,
                            gzipExclude: ['.png', '.ico', '.txt', '.jpg', '.woff']
                        }
                    }
                ]
            }
        },
        compress: {
            main: {
                options: {
                    mode: 'gzip',
                    level: 9
                },
                expand: true,
                cwd: 'dist/',
                dest: 'dist/',
                src: [
                  '**/*.css',
                  '**/*.js',
                  '**/*.eot',
                  '**/*.svg',
                  '**/*.ttf'
                ]
            }
        }
    });

    grunt.registerTask('default', []);

    // Dev
    grunt.registerTask('server', function () {
        grunt.task.run([
            'clean:server',
            'clean:grunticon',
            'svgmin',
            'grunticon:server',
            'bower:install',
            'less:server',
            'connect:server',
            'watch'
        ]);
    });

    // Build
    grunt.registerTask('build', function () {
        grunt.task.run([
            'clean:dist',
            'clean:grunticon',
            'useminPrepare',
            'copy:dist',
            'bower:install',
            'less:dist',
            'svgmin',
            'grunticon:dist',
            'requirejs',
            'concat',
            'uglify:dist',
            'usemin'
            // 'compress:main'
        ]);
    });

    // Dev
    grunt.registerTask('icons', function () {
        grunt.task.run([
            'clean:grunticon',
            'svgmin',
            'grunticon:server',
        ]);
    });
};
<|endoftext|>


<commit_before>// Generated on 2015-06-23 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']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/scripts/**/*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9009,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35731
      },
      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: 9010,
          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'],
        exclude: [
            'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
            // Leaflet provided by cartodb.js
            'bower_components/leaflet-dist/*'
        ],
        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
    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: './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: {
          sourcemap: 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',
          '<%= yeoman.dist %>/styles'
        ]
      }
    },

    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', 'scripts/**/*.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}',
            'styles/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: [
        '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',
      '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'
  ]);
};
<commit_msg>Move livereload to a different port for conflict resolution<commit_after>// Generated on 2015-06-23 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']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/scripts/**/*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9009,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35733
      },
      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: 9010,
          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'],
        exclude: [
            'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
            // Leaflet provided by cartodb.js
            'bower_components/leaflet-dist/*'
        ],
        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
    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: './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: {
          sourcemap: 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',
          '<%= yeoman.dist %>/styles'
        ]
      }
    },

    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', 'scripts/**/*.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}',
            'styles/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: [
        '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',
      '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'
  ]);
};
<|endoftext|>


<commit_before>var inspect = require("util").inspect,
    fs = require("fs");

module.exports = function(grunt) {

  var task = grunt.task;
  var file = grunt.file;
  var log = grunt.log;
  var verbose = grunt.verbose;
  var fail = grunt.fail;
  var option = grunt.option;
  var config = grunt.config;
  var template = grunt.template;
  var _ = grunt.util._;

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),
    nodeunit: {
      tests: [
        "test/spark.js"
      ]
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        node: true,
        strict: false,
        globals: {
          exports: true,
          document: true,
          WeakMap: true,
          window: true
        }
      },
      files: {
        src: [
          "Gruntfile.js",
          "lib/**/*.js",
          "test/**/*.js",
          "eg/**/*.js"
        ]
      }
    },

    jsbeautifier: {
      files: ["lib/**/*.js", "eg/**/*.js", "test/**/*.js"],
      options: {
        js: {
          braceStyle: "collapse",
          breakChainedMethods: false,
          e4x: false,
          evalCode: false,
          indentChar: " ",
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: false,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 0
        }
      }
    },
    watch: {
      src: {
        files: [
          "Gruntfile.js",
          "lib/**/!(johnny-five)*.js",
          "test/**/*.js",
          "eg/**/*.js"
        ],
        tasks: ["default"],
        options: {
          interrupt: true,
        },
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-contrib-nodeunit");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-jsbeautifier");

  grunt.registerTask("default", ["jshint", "nodeunit"]);
};
<commit_msg>Gruntfile: jshintrc, latedef: false<commit_after>var inspect = require("util").inspect,
    fs = require("fs");

module.exports = function(grunt) {

  var task = grunt.task;
  var file = grunt.file;
  var log = grunt.log;
  var verbose = grunt.verbose;
  var fail = grunt.fail;
  var option = grunt.option;
  var config = grunt.config;
  var template = grunt.template;
  var _ = grunt.util._;

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),
    nodeunit: {
      tests: [
        "test/spark.js"
      ]
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: false,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        node: true,
        strict: false,
        globals: {
          exports: true,
          document: true,
          WeakMap: true,
          window: true
        }
      },
      files: {
        src: [
          "Gruntfile.js",
          "lib/**/*.js",
          "test/**/*.js",
          "eg/**/*.js"
        ]
      }
    },

    jsbeautifier: {
      files: ["lib/**/*.js", "eg/**/*.js", "test/**/*.js"],
      options: {
        js: {
          braceStyle: "collapse",
          breakChainedMethods: false,
          e4x: false,
          evalCode: false,
          indentChar: " ",
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: false,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 0
        }
      }
    },
    watch: {
      src: {
        files: [
          "Gruntfile.js",
          "lib/**/!(johnny-five)*.js",
          "test/**/*.js",
          "eg/**/*.js"
        ],
        tasks: ["default"],
        options: {
          interrupt: true,
        },
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-contrib-nodeunit");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-jsbeautifier");

  grunt.registerTask("default", ["jshint", "nodeunit"]);
};
<|endoftext|>


<commit_before>/*jshint node: true */
/*global module */
var requirejs = require('requirejs');
requirejs.config({
  appDir : __dirname + '/src/',
  baseUrl : __dirname + '/src/'
});

var generateInit = requirejs('generate');

var license = '/*!\n' +
 ' * Modernizr v3.0.0pre\n' +
 ' * modernizr.com\n' +
 ' *\n' +
 ' * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton\n' +
 ' * MIT License\n' +
 '*/\n' +
 ' \n' +
 '/*\n' +
 ' * Modernizr tests which native CSS3 and HTML5 features are available in the\n' +
 ' * current UA and makes the results available to you in two ways: as properties on\n' +
 ' * a global `Modernizr` object, and as classes on the `<html>` element. This\n' +
 ' * information allows you to progressively enhance your pages with a granular level\n' +
 ' * of control over the experience.\n' +
 ' *\n' +
 ' * Modernizr has an optional (*not included*) conditional resource loader called\n' +
 ' * `Modernizr.load()`, based on [Yepnope.js](http://yepnopejs.com). You can get a\n' +
 ' * build that includes `Modernizr.load()`, as well as choosing which feature tests\n' +
 ' * to include on the [Download page](http://www.modernizr.com/download/).\n' +
 ' *\n' +
 ' *\n' +
 ' * Authors        Faruk Ates, Paul Irish, Alex Sexton\n' +
 ' * Contributors   Ryan Seddon, Ben Alman\n' +
 ' */';

module.exports = function( grunt ) {
  'use strict';

  var modConfig = grunt.file.readJSON('lib/config-all.json');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/*!\n' +
        ' * <%= pkg.name %> v<%= pkg.version %>\n' +
        ' * modernizr.com\n *\n' +
        ' * Copyright (c) <%= pkg.author %>\n' +
        ' * <%= pkg.license %> License\n */',
      microbanner: '/*! <%= pkg.name %> <%= pkg.version %> (Custom Build) | <%= pkg.license %> */'
    },
    qunit: {
      files: ['test/index.html']
    },
    stripdefine: {
      build: {
        src: ['dist/modernizr-build.js']
      }
    },
    generateinit : {
      build: {
        src: ['tmp/modernizr-init.js']
      }
    },
    uglify : {
      options: {
      stripbanners: true,
      banner: '<%= meta.microbanner %>',
      mangle: {
            except: ['Modernizr']
          }
      },
      dist: {
        src: [
          'dist/modernizr-build.js'
        ],
        dest: 'dist/modernizr-build.min.js'
      }
    },
    watch: {
      files: '<%= jshint.files %>',
      tasks: 'jshint'
    },
    jshint: {
      options: {
        boss: true,
        browser: true,
        curly: false,
        devel: true,
        eqeqeq: false,
        eqnull: true,
        expr: true,
        evil: true,
        immed: false,
        laxcomma: true,
        newcap: false,
        noarg: true,
        smarttabs: true,
        sub: true,
        undef: true,
        globals: {
          Modernizr: true,
          DocumentTouch: true,
          TEST: true,
          SVGFEColorMatrixElement : true,
          Blob: true,
          define: true,
          require: true
        }
      },
    files: [
        'src/*.js',
        'feature-detects/*.js'
      ],
    gruntfile: 'Gruntfile.js'
    },
    clean: {
      build: ['build', 'dist', 'tmp'],
      postbuild: ['build', 'tmp']
    },
    copy: {
      build: {
        files: {
          'dist/modernizr-build.js': 'build/src/modernizr-build.js'
        }
      }
    },
    requirejs: {
      compile: {
        options: {
          dir: 'build',
          appDir: '.',
          baseUrl: 'src',
          optimize: "none",
          optimizeCss: "none",
          paths: {
            "test" : "../feature-detects",
            "modernizr-init" : "../tmp/modernizr-init"
          },
          modules : [{
            "name" : "modernizr-build",
            "include" : ["modernizr-init"],
            "create" : true
          }],
          fileExclusionRegExp: /^(.git|node_modules|modulizr|media|test)$/,
          wrap: {
            start: license + "\n;(function(window, document, undefined){",
            end: "})(this, document);"
          },
          onBuildWrite: function (id, path, contents) {
            if ((/define\(.*?\{/).test(contents)) {
              //Remove AMD ceremony for use without require.js or almond.js
              contents = contents.replace(/define\(.*?\{/, '');

              contents = contents.replace(/\}\);\s*?$/,'');

              if ( !contents.match(/Modernizr\.addTest\(/) && !contents.match(/Modernizr\.addAsyncTest\(/) ) {
                //remove last return statement and trailing })
                contents = contents.replace(/return.*[^return]*$/,'');
              }
            }
            else if ((/require\([^\{]*?\{/).test(contents)) {
              contents = contents.replace(/require[^\{]+\{/, '');
              contents = contents.replace(/\}\);\s*$/,'');
            }

            return contents;
          }
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-requirejs');

  // Strip define fn
  grunt.registerMultiTask('stripdefine', "Strip define call from dist file", function() {
    var mod = grunt.file.read( this.file.src[0] ).replace('define("modernizr-init",[], function(){});', '');

    // Hack the prefix into place. Anything is way to big for something so small.
    if ( modConfig && modConfig.classPrefix ) {
      mod = mod.replace("classPrefix : '',", "classPrefix : '" + modConfig.classPrefix.replace(/"/g, '\\"') + "',");
    }
    grunt.file.write( 'dist/modernizr-build.js', mod );
  });

  grunt.registerMultiTask('generateinit', "Generate Init file", function() {
    grunt.file.write('tmp/modernizr-init.js', generateInit(modConfig));
  });

  // Travis CI task.
  grunt.registerTask('travis', 'qunit');

  // Build
  grunt.registerTask('build', ['clean', 'generateinit', 'requirejs', 'copy', 'clean:postbuild', 'stripdefine', 'uglify']);
  grunt.registerTask('default', 'build');
};
<commit_msg>Move stripdefine to use loop<commit_after>/*jshint node: true */
/*global module */
var requirejs = require('requirejs');
requirejs.config({
  appDir : __dirname + '/src/',
  baseUrl : __dirname + '/src/'
});

var generateInit = requirejs('generate');

var license = '/*!\n' +
 ' * Modernizr v3.0.0pre\n' +
 ' * modernizr.com\n' +
 ' *\n' +
 ' * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton\n' +
 ' * MIT License\n' +
 '*/\n' +
 ' \n' +
 '/*\n' +
 ' * Modernizr tests which native CSS3 and HTML5 features are available in the\n' +
 ' * current UA and makes the results available to you in two ways: as properties on\n' +
 ' * a global `Modernizr` object, and as classes on the `<html>` element. This\n' +
 ' * information allows you to progressively enhance your pages with a granular level\n' +
 ' * of control over the experience.\n' +
 ' *\n' +
 ' * Modernizr has an optional (*not included*) conditional resource loader called\n' +
 ' * `Modernizr.load()`, based on [Yepnope.js](http://yepnopejs.com). You can get a\n' +
 ' * build that includes `Modernizr.load()`, as well as choosing which feature tests\n' +
 ' * to include on the [Download page](http://www.modernizr.com/download/).\n' +
 ' *\n' +
 ' *\n' +
 ' * Authors        Faruk Ates, Paul Irish, Alex Sexton\n' +
 ' * Contributors   Ryan Seddon, Ben Alman\n' +
 ' */';

module.exports = function( grunt ) {
  'use strict';

  var modConfig = grunt.file.readJSON('lib/config-all.json');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/*!\n' +
        ' * <%= pkg.name %> v<%= pkg.version %>\n' +
        ' * modernizr.com\n *\n' +
        ' * Copyright (c) <%= pkg.author %>\n' +
        ' * <%= pkg.license %> License\n */',
      microbanner: '/*! <%= pkg.name %> <%= pkg.version %> (Custom Build) | <%= pkg.license %> */'
    },
    qunit: {
      files: ['test/index.html']
    },
    stripdefine: {
      build: [
        'dist/modernizr-build.js'
      ]
    },
    generateinit : {
      build: {
        src: ['tmp/modernizr-init.js']
      }
    },
    uglify : {
      options: {
        stripbanners: true,
        banner: '<%= meta.microbanner %>',
        mangle: {
          except: ['Modernizr']
        }
      },
      dist: {
        src: [
          'dist/modernizr-build.js'
        ],
        dest: 'dist/modernizr-build.min.js'
      }
    },
    watch: {
      files: '<%= jshint.files %>',
      tasks: 'jshint'
    },
    jshint: {
      options: {
        boss: true,
        browser: true,
        curly: false,
        devel: true,
        eqeqeq: false,
        eqnull: true,
        expr: true,
        evil: true,
        immed: false,
        laxcomma: true,
        newcap: false,
        noarg: true,
        smarttabs: true,
        sub: true,
        undef: true,
        globals: {
          Modernizr: true,
          DocumentTouch: true,
          TEST: true,
          SVGFEColorMatrixElement : true,
          Blob: true,
          define: true,
          require: true
        }
      },
    files: [
        'Gruntfile.js',
        'src/*.js',
        'feature-detects/*.js'
      ]
    },
    clean: {
      build: ['build', 'dist', 'tmp'],
      postbuild: ['build', 'tmp']
    },
    copy: {
      build: {
        files: {
          'dist/modernizr-build.js': 'build/src/modernizr-build.js'
        }
      }
    },
    requirejs: {
      compile: {
        options: {
          dir: 'build',
          appDir: '.',
          baseUrl: 'src',
          optimize: "none",
          optimizeCss: "none",
          paths: {
            "test" : "../feature-detects",
            "modernizr-init" : "../tmp/modernizr-init"
          },
          modules : [{
            "name" : "modernizr-build",
            "include" : ["modernizr-init"],
            "create" : true
          }],
          fileExclusionRegExp: /^(.git|node_modules|modulizr|media|test)$/,
          wrap: {
            start: license + "\n;(function(window, document, undefined){",
            end: "})(this, document);"
          },
          onBuildWrite: function (id, path, contents) {
            if ((/define\(.*?\{/).test(contents)) {
              //Remove AMD ceremony for use without require.js or almond.js
              contents = contents.replace(/define\(.*?\{/, '');

              contents = contents.replace(/\}\);\s*?$/,'');

              if ( !contents.match(/Modernizr\.addTest\(/) && !contents.match(/Modernizr\.addAsyncTest\(/) ) {
                //remove last return statement and trailing })
                contents = contents.replace(/return.*[^return]*$/,'');
              }
            }
            else if ((/require\([^\{]*?\{/).test(contents)) {
              contents = contents.replace(/require[^\{]+\{/, '');
              contents = contents.replace(/\}\);\s*$/,'');
            }

            return contents;
          }
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-requirejs');

  // Strip define fn
  grunt.registerMultiTask('stripdefine', "Strip define call from dist file", function() {
    this.filesSrc.forEach(function(filepath) {
      var mod = grunt.file.read(filepath).replace('define("modernizr-init",[], function(){});', '');

      // Hack the prefix into place. Anything is way to big for something so small.
      if ( modConfig && modConfig.classPrefix ) {
        mod = mod.replace("classPrefix : '',", "classPrefix : '" + modConfig.classPrefix.replace(/"/g, '\\"') + "',");
      }
      grunt.file.write( 'dist/modernizr-build.js', mod );
    });
  });

  grunt.registerMultiTask('generateinit', "Generate Init file", function() {
    grunt.file.write('tmp/modernizr-init.js', generateInit(modConfig));
  });

  // Travis CI task.
  grunt.registerTask('travis', 'qunit');

  // Build
  grunt.registerTask('build', ['clean', 'generateinit', 'requirejs', 'copy', 'clean:postbuild', 'stripdefine', 'uglify']);
  grunt.registerTask('default', 'build');
};
<|endoftext|>


<commit_before>// Generated on 2014-10-10 using generator-angular 0.9.8
'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: {
			jade: {
				files: ['<%= yeoman.app %>/**/*.jade'],
				tasks: ['jade'],
				options: {
					livereload: '<%= connect.options.livereload %>'
				}
			},
			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}',
					'<%= yeoman.app %>/texts/*.json'
				]
			}
		},

		// 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 [
							require('grunt-connect-proxy/lib/utils').proxyRequest,
							connect.static('dist'),
							connect.static('.tmp'),
							connect().use(
								'/bower_components',
								connect.static('./bower_components')
							),
							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 %>'
				}
			},
			proxies: [
				{
					context: '/api',
					host: '127.0.0.1',
					port: 8000,
					https: false
				}

			]
		},

		// 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/'
					}
				]
			}
		},

		// 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: './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 %>/{,*/}*.css',
					'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
					'<%= 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.dist %>/index.html',
			options: {
				dest: '<%= yeoman.dist %>',
				flow: {
					html: {
						steps: {
							js: ['concat'], // 'uglifyjs'],
							css: ['concat', 'cssmin']
						},
						post: {}
					}
				}
			}
		},

		// Performs rewrites based on filerev and the useminPrepare configuration
		usemin: {
			html: ['<%= yeoman.dist %>/**/*.html'],
			css: ['<%= yeoman.dist %>/*.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/custom.js': [
							'<%= yeoman.dist %>/scripts/custom.js'
						],
						'<%= yeoman.dist %>/scripts/vendor.js': [
							'<%= yeoman.dist %>/scripts/vendor.js'
						]
				}
			}
		},
		// concat: {
		//   dist: {}
		// },

		concat: {
			options: {
				separator: '',
				process: function(src, filepath) {
					return (filepath.length > 2 && filepath.substr(-2) == 'js' ? ';' : '') + src;
				},
			},
		},

		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: '<%= yeoman.dist %>/scripts',
						src: ['*.js', '!oldieshim.js'],
						dest: '<%= yeoman.dist %>/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/*',
							'sitemap.xml',
							'texts/*'
						]
					},
					{
						expand: true,
						cwd: '.tmp/images',
						dest: '<%= yeoman.dist %>/images',
						src: ['generated/*']
					},
					{
						expand: true,
						cwd: '.',
						src: 'bower_components/ultima/**/*',
						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: [
				'compass:server'
			],
			test: [
				'compass'
			],
			dist: [
				'compass:dist',
				'imagemin',
				'svgmin'
			]
		},

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

		// Jade template engine
		jade: {
			dist: {
				options: {
					pretty: true
				},
				files: [
					{
						expand: true,
						cwd: '<%= yeoman.app %>',
						dest: '<%= yeoman.dist %>',
						src: ['*.jade', 'views/**/*.jade'],
						ext: '.html'
					}
				]
			}
		},

		// Deploy via sftp
		// authentication information stored in .ftppass (not under version control)
		'sftp-deploy': {
			staging: {
				auth: {
					host: 'desec.io',
					port: 22,
					authKey: 'desec-io'
				},
				src: '<%= yeoman.dist %>',
				dest: '/var/www/webclient-staging',
				exclusions: [],
				serverSep: '/',
				concurrency: 4,
				progress: true
			},
			live: {
				auth: {
					host: 'desec.io',
					port: 22,
					authKey: 'desec-io'
				},
				src: '<%= yeoman.dist %>',
				dest: '/var/www/webclient-live',
				exclusions: [],
				serverSep: '/',
				concurrency: 4,
				progress: true
			}
		},
	});

	grunt.registerTask('fillcache', 'Request all known application URLs from the sitemap once with _escaped_fragment_, discarding the reply', function() {
		var done = this.async();
		var sitemap = grunt.file.read('app/sitemap.xml');
		var urls = (sitemap.match(/<loc>[^<>]*<\/loc>/g) || []).map(function(s) { return s.substr(5, s.length - 11).replace('#!', '?_escaped_fragment_=') });
		urls.push("https://desec.io/?_escaped_fragment_=");
		var https = require('https');
		var completed = 0;
		var requested = 0;
		var timing = {};

		function printProgress() {
			console.log('Status: ' + completed + '/' + requested + ', ' + Math.round(completed/requested*100) + '%');
		}

		urls.forEach(function(url) {
			timing[url] = Date.now();
			requested++;
			https.get(url, function() {
				timing[url] = Date.now() - timing[url];
				completed++;
				console.log(url + ' -- ' + timing[url] + 'ms');
				printProgress();
				if (completed-requested === 0)
					done();
			});
		});
	});

	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',
			'configureProxies:server',
			'concurrent:server',
			'autoprefixer',
			'jade',
			'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',
		'jade',
		'connect:test',
		'karma'
	]);

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

	grunt.registerTask('deploylive', [
		'build',
		'sftp-deploy:live'
	]);

	grunt.registerTask('deploy', [
		'build',
		'sftp-deploy:staging'
	]);

	grunt.registerTask('default', [
		'newer:jshint',
		'test',
		'build'
	]);
};
<commit_msg>fix(grunt): remove old deployment mechanism<commit_after>// Generated on 2014-10-10 using generator-angular 0.9.8
'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: {
			jade: {
				files: ['<%= yeoman.app %>/**/*.jade'],
				tasks: ['jade'],
				options: {
					livereload: '<%= connect.options.livereload %>'
				}
			},
			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}',
					'<%= yeoman.app %>/texts/*.json'
				]
			}
		},

		// 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 [
							require('grunt-connect-proxy/lib/utils').proxyRequest,
							connect.static('dist'),
							connect.static('.tmp'),
							connect().use(
								'/bower_components',
								connect.static('./bower_components')
							),
							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 %>'
				}
			},
			proxies: [
				{
					context: '/api',
					host: '127.0.0.1',
					port: 8000,
					https: false
				}

			]
		},

		// 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/'
					}
				]
			}
		},

		// 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: './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 %>/{,*/}*.css',
					'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
					'<%= 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.dist %>/index.html',
			options: {
				dest: '<%= yeoman.dist %>',
				flow: {
					html: {
						steps: {
							js: ['concat'], // 'uglifyjs'],
							css: ['concat', 'cssmin']
						},
						post: {}
					}
				}
			}
		},

		// Performs rewrites based on filerev and the useminPrepare configuration
		usemin: {
			html: ['<%= yeoman.dist %>/**/*.html'],
			css: ['<%= yeoman.dist %>/*.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/custom.js': [
							'<%= yeoman.dist %>/scripts/custom.js'
						],
						'<%= yeoman.dist %>/scripts/vendor.js': [
							'<%= yeoman.dist %>/scripts/vendor.js'
						]
				}
			}
		},
		// concat: {
		//   dist: {}
		// },

		concat: {
			options: {
				separator: '',
				process: function(src, filepath) {
					return (filepath.length > 2 && filepath.substr(-2) == 'js' ? ';' : '') + src;
				},
			},
		},

		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: '<%= yeoman.dist %>/scripts',
						src: ['*.js', '!oldieshim.js'],
						dest: '<%= yeoman.dist %>/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/*',
							'sitemap.xml',
							'texts/*'
						]
					},
					{
						expand: true,
						cwd: '.tmp/images',
						dest: '<%= yeoman.dist %>/images',
						src: ['generated/*']
					},
					{
						expand: true,
						cwd: '.',
						src: 'bower_components/ultima/**/*',
						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: [
				'compass:server'
			],
			test: [
				'compass'
			],
			dist: [
				'compass:dist',
				'imagemin',
				'svgmin'
			]
		},

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

		// Jade template engine
		jade: {
			dist: {
				options: {
					pretty: true
				},
				files: [
					{
						expand: true,
						cwd: '<%= yeoman.app %>',
						dest: '<%= yeoman.dist %>',
						src: ['*.jade', 'views/**/*.jade'],
						ext: '.html'
					}
				]
			}
		},
	});

	grunt.registerTask('fillcache', 'Request all known application URLs from the sitemap once with _escaped_fragment_, discarding the reply', function() {
		var done = this.async();
		var sitemap = grunt.file.read('app/sitemap.xml');
		var urls = (sitemap.match(/<loc>[^<>]*<\/loc>/g) || []).map(function(s) { return s.substr(5, s.length - 11).replace('#!', '?_escaped_fragment_=') });
		urls.push("https://desec.io/?_escaped_fragment_=");
		var https = require('https');
		var completed = 0;
		var requested = 0;
		var timing = {};

		function printProgress() {
			console.log('Status: ' + completed + '/' + requested + ', ' + Math.round(completed/requested*100) + '%');
		}

		urls.forEach(function(url) {
			timing[url] = Date.now();
			requested++;
			https.get(url, function() {
				timing[url] = Date.now() - timing[url];
				completed++;
				console.log(url + ' -- ' + timing[url] + 'ms');
				printProgress();
				if (completed-requested === 0)
					done();
			});
		});
	});

	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',
			'configureProxies:server',
			'concurrent:server',
			'autoprefixer',
			'jade',
			'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',
		'jade',
		'connect:test',
		'karma'
	]);

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

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


<commit_before>module.exports = function(grunt) {
    "use strict";

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        bt: {
            dist: 'dist',
            uglify: {
                files: {
                    'dist/scroll-min.js': ['dist/scroll-min.js']
                }
            },
            browserify: {
                files: {
                    'dist/scroll.js': ['src/dist/scroll.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'Scroll'
                    }

                }
            },
            tests: {
                qunit: {
                    src: ['tests/*.js']
                }
            }
        }
    });

    require("load-grunt-tasks")(grunt);
};<commit_msg>Ensuring min file gets compiled correctly<commit_after>module.exports = function(grunt) {
    "use strict";

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        bt: {
            dist: 'dist',
            uglify: {
                files: {
                    'dist/scroll-min.js': ['dist/scroll.js']
                }
            },
            browserify: {
                files: {
                    'dist/scroll.js': ['src/dist/scroll.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'Scroll'
                    }

                }
            },
            tests: {
                qunit: {
                    src: ['tests/*.js']
                }
            }
        }
    });

    require("load-grunt-tasks")(grunt);
};<|endoftext|>


<commit_before>/*
 * grunt-appcache
 *
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {
  grunt.initConfig({
    eslint: {
      all: [
        'Gruntfile.js',
        'tasks/**/*.js',
        'test/**/*.js',
        '<%= nodeunit.tests %>',
        '!node_modules/**/*.js',
      ],
    },

    clean: {
      tests: ['tmp'],
    },

    appcache: {
      options: {
        basePath: 'test',
      },
      test: {
        dest: 'tmp/appcache.manifest',
        cache: 'test/**/*',
      },
    },

    nodeunit: {
      tests: ['test/*_test.js'],
    },
  });

  grunt.loadTasks('tasks');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  grunt.registerTask('build', ['clean', 'appcache']);
  grunt.registerTask('test', ['eslint', 'nodeunit']);
  grunt.registerTask('verify', ['build', 'test']);
  grunt.registerTask('default', ['build', 'test']);
};
<commit_msg>eslint: remove node_modules blacklist<commit_after>/*
 * grunt-appcache
 *
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {
  grunt.initConfig({
    eslint: {
      all: [
        'Gruntfile.js',
        'tasks/**/*.js',
        'test/**/*.js',
        '<%= nodeunit.tests %>',
      ],
    },

    clean: {
      tests: ['tmp'],
    },

    appcache: {
      options: {
        basePath: 'test',
      },
      test: {
        dest: 'tmp/appcache.manifest',
        cache: 'test/**/*',
      },
    },

    nodeunit: {
      tests: ['test/*_test.js'],
    },
  });

  grunt.loadTasks('tasks');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  grunt.registerTask('build', ['clean', 'appcache']);
  grunt.registerTask('test', ['eslint', 'nodeunit']);
  grunt.registerTask('verify', ['build', 'test']);
  grunt.registerTask('default', ['build', 'test']);
};
<|endoftext|>