<commit_before>// Generated on 2014-05-01 using generator-angular-require 0.1.13
'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);

    // 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: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['newer:jshint:all'],
                options: {
                    livereload: true
                }
            },
            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: 8080,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost',
                livereload: 35729
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    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: [
                '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: {
//                html: '<%= yeoman.app %>/index.html',
//                ignorePath: '<%= yeoman.app %>/'
//            }
            target: {
                // Point to the files that should be updated when you run `grunt wiredep`
                src: [
                    '<%= yeoman.app %>/index.html'   // .html support...
//                    'app/styles/main.scss',  // .scss & .sass support...
                ],
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // 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: {
            options: {
                encoding: 'utf8',
                algorithm: 'md5',
                length: 8
            },
            images: {
                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', '<%= yeoman.dist %>/scripts/**/*.html'],
            options: {
                dest: '<%= yeoman.dist %>',
                basedir: '<%= yeoman.dist %>',
                dirs: '<%= yeoman.dist %>'
            }
        },

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

        // The following *-min tasks produce minified files in the dist folder
        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,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: true
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= yeoman.dist %>',
                        src: ['*.html', 'scripts/**/*.html'],
                        dest: '<%= yeoman.dist %>'
                    }
                ]
            }
        },

        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
        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',
                            'scripts/**/*.html',
                            'bower_components/**/*',
                            'images/{,*/}*.{webp}',
                            'fonts/*',
                            'i18n/*'
                        ]
                    },
                    {
                        expand: true,
                        cwd: '.tmp/images',
                        dest: '<%= yeoman.dist %>/images',
                        src: ['generated/*']
                    }
                ]
            },
            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: 'karma.conf.js',
                singleRun: true
            }
        },

        // Settings for grunt-bower-requirejs
        bower: {
            app: {
                rjsConfig: '<%= yeoman.app %>/scripts/main.js',
                options: {
                    // exclude cryptojslib, as this causes problems when executing grunt build
                    // the problem is that a cryptojslib path will be added to the requirejs config which cannot be used
                    // because of wildcards within the main property of cryptojslib's bower.js file
                    exclude: ['requirejs', 'json3', 'es5-shim', 'cryptojslib']
                }
            }
        },

        replace: {
            test: {
                src: '<%= yeoman.app %>/../test/test-main.js',
                overwrite: true,
                replacements: [
                    {
                        from: /paths: {[^}]+}/,
                        to: function () {
                            return require('fs').readFileSync(grunt.template.process('<%= yeoman.app %>') + '/scripts/main.js').toString().match(/paths: {[^}]+}/);
                        }
                    }
                ]
            }
        },

        // r.js compile config
        requirejs: {
            dist: {
                options: {
                    dir: "<%= yeoman.dist %>/scripts/",
                    modules: [
                        {
                            name: 'main'
                        }
                    ],
                    preserveLicenseComments: false, // remove all comments
                    removeCombined: true,
                    baseUrl: '<%= yeoman.app %>/scripts',
                    mainConfigFile: '<%= yeoman.app %>/scripts/main.js',
                    optimize: 'uglify2',
                    uglify2: {
                        mangle: false
                    }
                }
            }
        }
    });

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

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

//    grunt.registerTask('server', 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',
        'bower:app',
        'replace:test',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'ngAnnotate',
        'copy:dist',
        'cdnify',
        'cssmin',
        'requirejs:dist',
        'filerev',
        'usemin',
        'htmlmin'
    ]);

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

};
<commit_msg>- replaced " with '<commit_after>// Generated on 2014-05-01 using generator-angular-require 0.1.13
'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);

    // 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: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['newer:jshint:all'],
                options: {
                    livereload: true
                }
            },
            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: 8080,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost',
                livereload: 35729
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    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: [
                '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: {
//                html: '<%= yeoman.app %>/index.html',
//                ignorePath: '<%= yeoman.app %>/'
//            }
            target: {
                // Point to the files that should be updated when you run `grunt wiredep`
                src: [
                    '<%= yeoman.app %>/index.html'   // .html support...
//                    'app/styles/main.scss',  // .scss & .sass support...
                ],
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // 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: {
            options: {
                encoding: 'utf8',
                algorithm: 'md5',
                length: 8
            },
            images: {
                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', '<%= yeoman.dist %>/scripts/**/*.html'],
            options: {
                dest: '<%= yeoman.dist %>',
                basedir: '<%= yeoman.dist %>',
                dirs: '<%= yeoman.dist %>'
            }
        },

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

        // The following *-min tasks produce minified files in the dist folder
        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,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: true
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= yeoman.dist %>',
                        src: ['*.html', 'scripts/**/*.html'],
                        dest: '<%= yeoman.dist %>'
                    }
                ]
            }
        },

        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
        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',
                            'scripts/**/*.html',
                            'bower_components/**/*',
                            'images/{,*/}*.{webp}',
                            'fonts/*',
                            'i18n/*'
                        ]
                    },
                    {
                        expand: true,
                        cwd: '.tmp/images',
                        dest: '<%= yeoman.dist %>/images',
                        src: ['generated/*']
                    }
                ]
            },
            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: 'karma.conf.js',
                singleRun: true
            }
        },

        // Settings for grunt-bower-requirejs
        bower: {
            app: {
                rjsConfig: '<%= yeoman.app %>/scripts/main.js',
                options: {
                    // exclude cryptojslib, as this causes problems when executing grunt build
                    // the problem is that a cryptojslib path will be added to the requirejs config which cannot be used
                    // because of wildcards within the main property of cryptojslib's bower.js file
                    exclude: ['requirejs', 'json3', 'es5-shim', 'cryptojslib']
                }
            }
        },

        replace: {
            test: {
                src: '<%= yeoman.app %>/../test/test-main.js',
                overwrite: true,
                replacements: [
                    {
                        from: /paths: {[^}]+}/,
                        to: function () {
                            return require('fs').readFileSync(grunt.template.process('<%= yeoman.app %>') + '/scripts/main.js').toString().match(/paths: {[^}]+}/);
                        }
                    }
                ]
            }
        },

        // r.js compile config
        requirejs: {
            dist: {
                options: {
                    dir: '<%= yeoman.dist %>/scripts/',
                    modules: [
                        {
                            name: 'main'
                        }
                    ],
                    preserveLicenseComments: false, // remove all comments
                    removeCombined: true,
                    baseUrl: '<%= yeoman.app %>/scripts',
                    mainConfigFile: '<%= yeoman.app %>/scripts/main.js',
                    optimize: 'uglify2',
                    uglify2: {
                        mangle: false
                    }
                }
            }
        }
    });

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

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

//    grunt.registerTask('server', 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',
        'bower:app',
        'replace:test',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'ngAnnotate',
        'copy:dist',
        'cdnify',
        'cssmin',
        'requirejs:dist',
        'filerev',
        'usemin',
        'htmlmin'
    ]);

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

};
<|endoftext|>


<commit_before>/* global module:false */
module.exports = function(grunt) {
	var port = grunt.option('port') || 8000;
	var root = grunt.option('root') || '.';

	if (!Array.isArray(root)) root = [root];

	// Project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner:
				'/*!\n' +
				' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
				' * http://lab.hakim.se/reveal-js\n' +
				' * MIT licensed\n' +
				' *\n' +
				' * Copyright (C) 2017 Hakim El Hattab, http://hakim.se\n' +
				' */'
		},

		qunit: {
			files: [ 'test/*.html' ]
		},

		uglify: {
			options: {
				banner: '<%= meta.banner %>\n',
				screwIE8: false
			},
			build: {
				src: 'js/reveal.js',
				dest: 'js/reveal.min.js'
			}
		},

		sass: {
			core: {
				src: 'css/reveal.scss',
				dest: 'css/reveal.css'
			},
			themes: {
				expand: true,
				cwd: 'css/theme/source',
				src: ['*.sass', '*.scss'],
				dest: 'css/theme',
				ext: '.css'
			}
		},

		autoprefixer: {
			core: {
				src: 'css/reveal.css'
			}
		},

		cssmin: {
			options: {
				compatibility: 'ie9'
			},
			compress: {
				src: 'css/reveal.css',
				dist: 'css/reveal.min.css'
			}
		},

		jshint: {
			options: {
				curly: false,
				eqeqeq: true,
				immed: true,
				esnext: true,
				latedef: 'nofunc',
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				eqnull: true,
				browser: true,
				expr: true,
				globals: {
					head: false,
					module: false,
					console: false,
					unescape: false,
					define: false,
					exports: false
				}
			},
			files: [ 'Gruntfile.js', 'js/reveal.js' ]
		},

		connect: {
			server: {
				options: {
					port: port,
					base: root,
					livereload: true,
					open: true,
					useAvailablePort: true
				}
			}
		},

		zip: {
			bundle: {
				src: [
					'index.html',
					'css/**',
					'js/**',
					'lib/**',
					'images/**',
					'plugin/**',
					'**.md'
				],
				dest: 'reveal-js-presentation.zip'
			}
		},

		watch: {
			js: {
				files: [ 'Gruntfile.js', 'js/reveal.js' ],
				tasks: 'js'
			},
			theme: {
				files: [
					'css/theme/source/*.sass',
					'css/theme/source/*.scss',
					'css/theme/template/*.sass',
					'css/theme/template/*.scss'
				],
				tasks: 'css-themes'
			},
			css: {
				files: [ 'css/reveal.scss' ],
				tasks: 'css-core'
			},
			html: {
				files: root.map(path => path + '/*.html')
			},
			markdown: {
				files: root.map(path => path + '/*.md')
			},
			options: {
				livereload: true
			}
		},

		retire: {
			js: [ 'js/reveal.js', 'lib/js/*.js', 'plugin/**/*.js' ],
			node: [ '.' ]
		}

	});

	// Dependencies
	grunt.loadNpmTasks( 'grunt-contrib-connect' );
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	grunt.loadNpmTasks( 'grunt-contrib-watch' );
	grunt.loadNpmTasks( 'grunt-autoprefixer' );
	grunt.loadNpmTasks( 'grunt-retire' );
	grunt.loadNpmTasks( 'grunt-sass' );
	grunt.loadNpmTasks( 'grunt-zip' );

	// Default task
	grunt.registerTask( 'default', [ 'css', 'js' ] );

	// JS task
	grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );

	// Theme CSS
	grunt.registerTask( 'css-themes', [ 'sass:themes' ] );

	// Core framework CSS
	grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );

	// All CSS
	grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );

	// Package presentation to archive
	grunt.registerTask( 'package', [ 'default', 'zip' ] );

	// Serve presentation locally
	grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

	// Run tests
	grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );

};
<commit_msg>correct target for cssmin<commit_after>/* global module:false */
module.exports = function(grunt) {
	var port = grunt.option('port') || 8000;
	var root = grunt.option('root') || '.';

	if (!Array.isArray(root)) root = [root];

	// Project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner:
				'/*!\n' +
				' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
				' * http://lab.hakim.se/reveal-js\n' +
				' * MIT licensed\n' +
				' *\n' +
				' * Copyright (C) 2017 Hakim El Hattab, http://hakim.se\n' +
				' */'
		},

		qunit: {
			files: [ 'test/*.html' ]
		},

		uglify: {
			options: {
				banner: '<%= meta.banner %>\n',
				screwIE8: false
			},
			build: {
				src: 'js/reveal.js',
				dest: 'js/reveal.min.js'
			}
		},

		sass: {
			core: {
				src: 'css/reveal.scss',
				dest: 'css/reveal.css'
			},
			themes: {
				expand: true,
				cwd: 'css/theme/source',
				src: ['*.sass', '*.scss'],
				dest: 'css/theme',
				ext: '.css'
			}
		},

		autoprefixer: {
			core: {
				src: 'css/reveal.css'
			}
		},

		cssmin: {
			options: {
				compatibility: 'ie9'
			},
			compress: {
				src: 'css/reveal.css',
				dest: 'css/reveal.min.css'
			}
		},

		jshint: {
			options: {
				curly: false,
				eqeqeq: true,
				immed: true,
				esnext: true,
				latedef: 'nofunc',
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				eqnull: true,
				browser: true,
				expr: true,
				globals: {
					head: false,
					module: false,
					console: false,
					unescape: false,
					define: false,
					exports: false
				}
			},
			files: [ 'Gruntfile.js', 'js/reveal.js' ]
		},

		connect: {
			server: {
				options: {
					port: port,
					base: root,
					livereload: true,
					open: true,
					useAvailablePort: true
				}
			}
		},

		zip: {
			bundle: {
				src: [
					'index.html',
					'css/**',
					'js/**',
					'lib/**',
					'images/**',
					'plugin/**',
					'**.md'
				],
				dest: 'reveal-js-presentation.zip'
			}
		},

		watch: {
			js: {
				files: [ 'Gruntfile.js', 'js/reveal.js' ],
				tasks: 'js'
			},
			theme: {
				files: [
					'css/theme/source/*.sass',
					'css/theme/source/*.scss',
					'css/theme/template/*.sass',
					'css/theme/template/*.scss'
				],
				tasks: 'css-themes'
			},
			css: {
				files: [ 'css/reveal.scss' ],
				tasks: 'css-core'
			},
			html: {
				files: root.map(path => path + '/*.html')
			},
			markdown: {
				files: root.map(path => path + '/*.md')
			},
			options: {
				livereload: true
			}
		},

		retire: {
			js: [ 'js/reveal.js', 'lib/js/*.js', 'plugin/**/*.js' ],
			node: [ '.' ]
		}

	});

	// Dependencies
	grunt.loadNpmTasks( 'grunt-contrib-connect' );
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	grunt.loadNpmTasks( 'grunt-contrib-watch' );
	grunt.loadNpmTasks( 'grunt-autoprefixer' );
	grunt.loadNpmTasks( 'grunt-retire' );
	grunt.loadNpmTasks( 'grunt-sass' );
	grunt.loadNpmTasks( 'grunt-zip' );

	// Default task
	grunt.registerTask( 'default', [ 'css', 'js' ] );

	// JS task
	grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );

	// Theme CSS
	grunt.registerTask( 'css-themes', [ 'sass:themes' ] );

	// Core framework CSS
	grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );

	// All CSS
	grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );

	// Package presentation to archive
	grunt.registerTask( 'package', [ 'default', 'zip' ] );

	// Serve presentation locally
	grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

	// Run tests
	grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );

};
<|endoftext|>


<commit_before>/**
 *
 * Copyright 2012 Adobe Systems Inc.;
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/*global module:false*/

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({

        clean: {
            release: ['css']
        },

        topcoat: {
            options: {
                browsers: ['last 2 versions'],
                license: grunt.file.read('test/fixtures/license.txt', 'utf-8')
            },
            compile: {
                files: [{
                        src: 'test/fixtures/navigation-bar.css',
                        dest: 'css/navigation-bar.css'
                    }
                ]
            }
        },

        cssmin: {
            minify: {
                expand: true,
                cwd: 'css',
                src: ['*.css', '!*.min.css'],
                dest: 'css',
                ext: '.min.css'
            },
        },

        simplemocha: {
            all: {
                src: ['test/*.test.js']
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-topcoat');
    grunt.loadNpmTasks('grunt-simple-mocha');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');

    grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
    grunt.registerTask('build', ['topcoat']);
    grunt.registerTask('test', ['simplemocha']);
    grunt.registerTask('release', ['cssmin']);

};
<commit_msg>removed unused comma<commit_after>/**
 *
 * Copyright 2012 Adobe Systems Inc.;
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/*global module:false*/

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({

        clean: {
            release: ['css']
        },

        topcoat: {
            options: {
                browsers: ['last 2 versions'],
                license: grunt.file.read('test/fixtures/license.txt', 'utf-8')
            },
            compile: {
                files: [{
                        src: 'test/fixtures/navigation-bar.css',
                        dest: 'css/navigation-bar.css'
                    }
                ]
            }
        },

        cssmin: {
            minify: {
                expand: true,
                cwd: 'css',
                src: ['*.css', '!*.min.css'],
                dest: 'css',
                ext: '.min.css'
            }
        },

        simplemocha: {
            all: {
                src: ['test/*.test.js']
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-topcoat');
    grunt.loadNpmTasks('grunt-simple-mocha');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');

    grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
    grunt.registerTask('build', ['topcoat']);
    grunt.registerTask('test', ['simplemocha']);
    grunt.registerTask('release', ['cssmin']);

};
<|endoftext|>


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

  'use strict';

  require('time-grunt')(grunt);

  var path = require('path');
  var extend = require('node.extend');

  /**
   * Load the tasks we want to use, which are specified as dependencies in
   * the package.json file of cf-grunt-config.
   */

  // Sets the CWD to the cf-grunt-config package so that the loadTasks method
  // (employed in jit-grunt) looks in the correct place.
  grunt.file.setBase('./node_modules/cf-grunt-config/');
  // Loads all Grunt tasks in the node_modules directory within the new CWD.
  require('jit-grunt')(grunt, {
    // Below line needed because task name does not match package name
    bower: 'grunt-bower-task'
  });
  // Sets the CWD back to the project root so that the tasks work as expected.
  grunt.file.setBase('../../');

  /**
   * Initialize a variable to represent the Grunt task configuration.
   */
  var config = {

    // Define a couple of utility variables that may be used in task options.
    pkg: grunt.file.readJSON('bower.json'),
    env: process.env,
    opt: {
      // Include path to compiled extra CSS for IE7 and below.
      // Definitely needed if this component depends on an icon font.
      // ltIE8Source: 'static/css/main.lt-ie8.min.css',

      // Include path to compiled alternate CSS for IE8 and below.
      // Definitely needed if this component depends on media queries.
      // ltIE9AltSource: 'static/css/main.lt-ie9.min.css',

      // Set whether or not to include html5shiv for demoing a component.
      // Only necessary if component patterns include new HTML5 elements
      html5Shiv: true,

      // Set whether you'd like to use a JS hack to force a redraw in the browser
      // to avoid an IE8 bug where fonts do not appear or appear as boxes on load.
      // ie8FontFaceHack: true,

      // Set a path to a concatenated JS file that you'd like to add before the
      // closing body tag.
      // jsBody: 'static/js/component.min.js',

      // Here's a banner with some template variables.
      // We'll be inserting it at the top of minified assets.
      // banner: grunt.file.read('./node_modules/cf-grunt-config/cfpb-banner.txt'),
    },

    // Define tasks specific to this project here

    less: {
      // Compile src/cf-grid.less for the docs.
      src: {
        options: {
          paths: grunt.file.expand('src'),
          sourceMap: false
        },
        files: {
          'docs/static/css/main.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'src/cf-grid.less'
          ]
        }
      },
      // Compile a version of cf-grids for CSS use.
      generated: {
        options: {
          paths: grunt.file.expand('src'),
          sourceMap: false
        },
        files: {
          'src-generated/cf-grid-generated.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'src-generated/cf-grid-generated.less'
          ]
        }
      },
      // Compile a version of cf-grid-generated.less for the custom demo.
      'custom-demo': {
        options: {
          paths: grunt.file.expand('src','src-generated'),
          sourceMap: false
        },
        files: {
          'custom-demo/static/css/demo.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'custom-demo/static/css/demo.less'
          ]
        }
      }
    }

  };

  /**
   * Define a function that, given the path argument, returns an object
   * containing all JS files in that directory.
   */
  function loadConfig(path) {
    var glob = require('glob');
    var object = {};
    var key;

    glob.sync('*', {cwd: path}).forEach(function(option) {
      key = option.replace(/\.js$/,'');
      object[key] = require(path + option);
      grunt.verbose.writeln("External config item - " + key + ": " + object[key]);
    });

    return object;
  }

  /**
   * Combine the config variable defined above with the results of calling the
   * loadConfig function with the given path, which is where our external
   * task options get installed by npm.
   */
  config = extend(true, loadConfig('./node_modules/cf-grunt-config/tasks/options/'), config);

  grunt.initConfig(config);

  /**
   * Load any project-specific tasks installed in the customary location.
   */
  require('load-grunt-tasks')(grunt);

  /**
   * Create custom task aliases for our component build workflow.
   */
  grunt.registerTask('vendor', ['bower']);
  grunt.registerTask('default', ['less:generated', 'less:custom-demo', 'autoprefixer', 'topdoc:docs']);

};
<commit_msg>Update less tasks.<commit_after>module.exports = function(grunt) {

  'use strict';

  require('time-grunt')(grunt);

  var path = require('path');
  var extend = require('node.extend');

  /**
   * Load the tasks we want to use, which are specified as dependencies in
   * the package.json file of cf-grunt-config.
   */

  // Sets the CWD to the cf-grunt-config package so that the loadTasks method
  // (employed in jit-grunt) looks in the correct place.
  grunt.file.setBase('./node_modules/cf-grunt-config/');
  // Loads all Grunt tasks in the node_modules directory within the new CWD.
  require('jit-grunt')(grunt, {
    // Below line needed because task name does not match package name
    bower: 'grunt-bower-task'
  });
  // Sets the CWD back to the project root so that the tasks work as expected.
  grunt.file.setBase('../../');

  /**
   * Initialize a variable to represent the Grunt task configuration.
   */
  var config = {

    // Define a couple of utility variables that may be used in task options.
    pkg: grunt.file.readJSON('bower.json'),
    env: process.env,
    opt: {
      // Include path to compiled extra CSS for IE7 and below.
      // Definitely needed if this component depends on an icon font.
      // ltIE8Source: 'static/css/main.lt-ie8.min.css',

      // Include path to compiled alternate CSS for IE8 and below.
      // Definitely needed if this component depends on media queries.
      // ltIE9AltSource: 'static/css/main.lt-ie9.min.css',

      // Set whether or not to include html5shiv for demoing a component.
      // Only necessary if component patterns include new HTML5 elements
      html5Shiv: true,

      // Set whether you'd like to use a JS hack to force a redraw in the browser
      // to avoid an IE8 bug where fonts do not appear or appear as boxes on load.
      // ie8FontFaceHack: true,

      // Set a path to a concatenated JS file that you'd like to add before the
      // closing body tag.
      // jsBody: 'static/js/component.min.js',

      // Here's a banner with some template variables.
      // We'll be inserting it at the top of minified assets.
      // banner: grunt.file.read('./node_modules/cf-grunt-config/cfpb-banner.txt'),
    },

    // Define tasks specific to this project here

    less: {
      // Compile src/cf-grid.less for the docs.
      src: {
        options: {
          paths: grunt.file.expand('src'),
          sourceMap: false
        },
        files: {
          'docs/static/css/main.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'src/cf-grid.less'
          ]
        }
      },
      // Compile a version of cf-grids for CSS use.
      generated: {
        options: {
          paths: grunt.file.expand('src'),
          sourceMap: false
        },
        files: {
          'src-generated/cf-grid-generated.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'src-generated/cf-grid-generated.less'
          ]
        }
      },
      // Compile a version of cf-grid-generated.less for the custom demo.
      'custom-demo': {
        options: {
          paths: grunt.file.expand('src','src-generated'),
          sourceMap: false
        },
        files: {
          'custom-demo/static/css/demo.css': [
            'src/vendor/normalize-css/normalize.css',
            'src/vendor/normalize-legacy-addon/normalize-legacy-addon.css',
            'custom-demo/static/css/demo.less'
          ]
        }
      }
    }

  };

  /**
   * Define a function that, given the path argument, returns an object
   * containing all JS files in that directory.
   */
  function loadConfig(path) {
    var glob = require('glob');
    var object = {};
    var key;

    glob.sync('*', {cwd: path}).forEach(function(option) {
      key = option.replace(/\.js$/,'');
      object[key] = require(path + option);
      grunt.verbose.writeln("External config item - " + key + ": " + object[key]);
    });

    return object;
  }

  /**
   * Combine the config variable defined above with the results of calling the
   * loadConfig function with the given path, which is where our external
   * task options get installed by npm.
   */
  config = extend(true, loadConfig('./node_modules/cf-grunt-config/tasks/options/'), config);

  grunt.initConfig(config);

  /**
   * Load any project-specific tasks installed in the customary location.
   */
  require('load-grunt-tasks')(grunt);

  /**
   * Create custom task aliases for our component build workflow.
   */
  grunt.registerTask('vendor', ['bower']);
  grunt.registerTask('default', ['less:src', 'less:generated', 'less:custom-demo', 'autoprefixer', 'topdoc:docs']);

};
<|endoftext|>


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

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

    // Compiles our Sass
    sass: {
      options: {
        precision: 6,
        sourceComments: false,
        outputStyle: 'compressed'
      },
      dist: {
        files: {
          'css/primer.css': 'scss/primer.scss'
        }
      }
    },

    // Handle vendor prefixing
    postcss: {
      options: {
        processors: [
          require('autoprefixer-core')({ browsers: ['last 2 versions', 'ie 8', 'ie 9'] })
        ]
      },
      dist: {
        src: 'css/*.css'
      },
      docs: {
        src: '_site/*.css'
      }
    },

    // Runs CSS reporting
    parker: {
      options: {
        metrics: [
          'TotalStylesheets',
          'TotalStylesheetSize',
          'TotalRules',
          'TotalSelectors',
          'TotalIdentifiers',
          'TotalDeclarations',
          'SelectorsPerRule',
          'IdentifiersPerSelector',
          'SpecificityPerSelector',
          'TopSelectorSpecificity',
          'TopSelectorSpecificitySelector',
          'TotalIdSelectors',
          'TotalUniqueColours',
          'TotalImportantKeywords',
          'TotalMediaQueries'
        ],
        file: "css/.primer-stats.md",
        usePackage: true
      },
      src: [
        'css/*.css'
      ]
    },

    // Build tooling

    watch: {
      sass: {
        files: ['scss/**/*.scss', 'docs/docs.scss'],
        tasks: ['sass', 'postcss', 'parker']
      }
    },

    jekyll: {
      options: {
        src: 'docs',
        dest: '_site',
        config: '_config.yml'
      }
    },

    buildcontrol: {
      options: {
        dir: '_site',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      pages: {
        options: {
          remote: 'git@github.com:primer/primer.git',
          branch: 'gh-pages'
        }
      }
    }
  });

  // Load dependencies
  grunt.loadNpmTasks('grunt-postcss');
  grunt.loadNpmTasks('grunt-build-control');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-parker');
  grunt.loadNpmTasks('grunt-sass');

  // Generate and format the CSS
  grunt.registerTask('default', ['sass', 'jekyll', 'postcss', 'parker']);

  // Publish to GitHub
  grunt.registerTask('publish', ['jekyll', 'postcss:docs', 'buildcontrol:pages']);
};
<commit_msg>Updating gruntfile gh-pages repo<commit_after>module.exports = function(grunt) {

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

    // Compiles our Sass
    sass: {
      options: {
        precision: 6,
        sourceComments: false,
        outputStyle: 'compressed'
      },
      dist: {
        files: {
          'css/primer.css': 'scss/primer.scss'
        }
      }
    },

    // Handle vendor prefixing
    postcss: {
      options: {
        processors: [
          require('autoprefixer-core')({ browsers: ['last 2 versions', 'ie 8', 'ie 9'] })
        ]
      },
      dist: {
        src: 'css/*.css'
      },
      docs: {
        src: '_site/*.css'
      }
    },

    // Runs CSS reporting
    parker: {
      options: {
        metrics: [
          'TotalStylesheets',
          'TotalStylesheetSize',
          'TotalRules',
          'TotalSelectors',
          'TotalIdentifiers',
          'TotalDeclarations',
          'SelectorsPerRule',
          'IdentifiersPerSelector',
          'SpecificityPerSelector',
          'TopSelectorSpecificity',
          'TopSelectorSpecificitySelector',
          'TotalIdSelectors',
          'TotalUniqueColours',
          'TotalImportantKeywords',
          'TotalMediaQueries'
        ],
        file: "css/.primer-stats.md",
        usePackage: true
      },
      src: [
        'css/*.css'
      ]
    },

    // Build tooling

    watch: {
      sass: {
        files: ['scss/**/*.scss', 'docs/docs.scss'],
        tasks: ['sass', 'postcss', 'parker']
      }
    },

    jekyll: {
      options: {
        src: 'docs',
        dest: '_site',
        config: '_config.yml'
      }
    },

    buildcontrol: {
      options: {
        dir: '_site',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      pages: {
        options: {
          remote: 'git@github.com:Alanaktion/primer.git',
          branch: 'gh-pages'
        }
      }
    }
  });

  // Load dependencies
  grunt.loadNpmTasks('grunt-postcss');
  grunt.loadNpmTasks('grunt-build-control');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-parker');
  grunt.loadNpmTasks('grunt-sass');

  // Generate and format the CSS
  grunt.registerTask('default', ['sass', 'jekyll', 'postcss', 'parker']);

  // Publish to GitHub
  grunt.registerTask('publish', ['jekyll', 'postcss:docs', 'buildcontrol:pages']);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
    grunt.registerTask('default', [
        'init',
        'test:app',
        'serve'
    ]);

    grunt.registerTask('init', 'ensure customizable files are in place', function () {
        initialize('/favicon.ico');
        initialize('/images/logo.png');
        initialize('/password.env.js');
        initialize('/password.config.theme.js');
    });

    grunt.registerTask('test', 'tests the app in different states, e.g., app or dist forms', function (appState) {
        grunt.task.run('jshint:testFiles');
        grunt.task.run('karma' + (appState ? ':' + appState : ''));
    });

    grunt.registerTask('dist', [
        'clean',
        'init',
        'wiredep',
        'jshint:appFiles',
        'useminPrepare',
        'html2js',
        'concat:generated',
        'replace:templateCache',
        'concat:templateCache',
        'ngAnnotate',
        'uglify',
        'cssmin',
        'copy',
        'imagemin',
        'filerev',
        'usemin',
        'htmlmin'
    ]);

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

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

    var appConfig = {
        app: {
            root: 'app',
            files: {
                css: [
                    '<%= passwordConfig.app.root %>/*.css',
                    '<%= passwordConfig.app.root %>/!(bower_components)/**/*.css'
                ],
                html: {
                    all: [
                        '<%= passwordConfig.app.root %>/*.html',
                        '<%= passwordConfig.app.files.html.views %>'
                    ],
                    views: '<%= passwordConfig.app.root %>/!(bower_components)/**/*.html'
                },
                images: {
                    full: '<%= passwordConfig.app.root %>/images/**/*.{png,svg}',
                    relative: [
                        '*.ico',
                        'images/**/*.{png,svg}'
                    ]
                },
                index: '<%= passwordConfig.app.root %>/index.html',
                js: {
                    all: [
                        '<%= passwordConfig.app.root %>/*.js',
                        '<%= passwordConfig.app.root %>/!(bower_components)/**/*.js'
                    ],
                    modules: [
                        '<%= passwordConfig.app.root %>/*.module.js',
                        '<%= passwordConfig.app.root %>/!(bower_components)/**/*.module.js'
                    ],
                    deps: [
                        '<%= passwordConfig.app.root %>/bower_components/angular/angular.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-route/angular-route.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-material/angular-material.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-animate/angular-animate.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-aria/angular-aria.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-messages/angular-messages.js',
                        '<%= passwordConfig.app.root %>/bower_components/angularytics/dist/angularytics.min.js'
                    ],
                    mocks: [
                        '<%= passwordConfig.app.root %>/bower_components/angular-mocks/angular-mocks.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-material/angular-material-mocks.js'
                    ]
                },
                spec: [
                    '<%= passwordConfig.app.root %>/*.spec.js',
                    '<%= passwordConfig.app.root %>/!(bower_components)/**/*.spec.js'
                ]
            }
        },
        dist: {
            root: 'dist',
            dirs: {
                images: '<%= passwordConfig.dist.root %>/images'
            },
            files: {
                css: '<%= passwordConfig.dist.root %>/styles/*.css',
                images: {
                    full: [
                        '<%= passwordConfig.dist.root %>/*.ico',
                        '<%= passwordConfig.dist.root %>/images/**/*.{png,svg}'
                    ],
                    relative: [
                        '*.ico',
                        '**/*.{png,svg}'
                    ]
                },
                index: '<%= passwordConfig.dist.root %>/index.html',
                js: {
                    all: '<%= passwordConfig.dist.root %>/scripts/*.js',
                    app: [
                        '<%= passwordConfig.dist.root %>/scripts/password.env.*.js',
                        '<%= passwordConfig.dist.root %>/scripts/password.*.js'
                    ],
                    lib: '<%= passwordConfig.dist.root %>/scripts/lib.*.js'
                }
            }
        },
        tmp: {
            root: '.tmp',
            dirs: {
                specs: '<%= passwordConfig.tmp.root %>/specs',
                scripts: '<%= passwordConfig.tmp.root %>/concat/scripts'
            },
            files: {
                app: '<%= passwordConfig.tmp.dirs.scripts %>/password.js',
                templateCache: '<%= passwordConfig.tmp.dirs.scripts %>/templates.js'
            }
        },
        htmlminOptions: {
            collapseBooleanAttributes: true,
            collapseWhitespace: true,
            conservativeCollapse: true,
            removeAttributeQuotes: true,
            removeComments: true,
            removeCommentsFromCDATA: true,
            removeEmptyAttributes: true,
            removeIgnored: true,
            removeOptionalTags: true,
            removeRedundantAttributes: true,
            removeScriptTypeAttributes: true,
            removeStyleLinkTypeAttributes: true
        },
        templateCache: {
            module: 'password.templates'
        }
    };

    grunt.registerTask('backend', 'determine which backend to put in place', function (type) {
          if (type === 'mock') {
              grunt.file.copy(appConfig.app.root + '/password.env.mock.js',
                              appConfig.app.root + '/password.env.js');

              grunt.log.ok('mock backend in place.');
          } else {
              grunt.file.delete(appConfig.app.root + '/password.env.js');

              grunt.task.run(['init']);

              grunt.log.ok('default backend in place.');
          }
    });

    function initialize(file) {
        var destpath = appConfig.app.root + file;

        if (grunt.file.exists(destpath)) {
            grunt.log.error(destpath + ' already initialized.');
        } else {
            var lastDot = /\.(?=[^.]*$)/,
                defaultFile = destpath.replace(lastDot, '.default.');

            grunt.file.copy(defaultFile,  destpath);

            grunt.log.ok(destpath + ' absent, initialized from ' + defaultFile + '.');
        }
    }

    require('load-grunt-tasks')(grunt);

    require('time-grunt')(grunt);

    grunt.initConfig({
        passwordConfig: appConfig,

        replace: {
            templateCache: {
                src: appConfig.tmp.files.app,
                options: {
                    patterns: [{
                        match: /\/\*@@DIST-TEMPLATE-CACHE\*\//,
                        replacement: '\'' + appConfig.templateCache.module + '\','
                    }]
                },
                dest: appConfig.tmp.files.app
            }
        },

        watch: {
            js: {
                files: appConfig.app.files.js.all,
                tasks: ['newer:jshint:appFiles'],
                options: {
                    livereload: '<%= connect.options.livereload %>'
                }
            },
            test: {
                files: appConfig.app.files.spec,
                tasks: ['newer:jshint:testFiles', 'test:app']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    appConfig.app.files.html.all,
                    appConfig.app.files.css,
                    appConfig.app.files.images.full
                ]
            }
        },

        connect: {
            options: {
                port: 9000,
                livereload: 35729
            },
            livereload: {
                options: {
                    open: true,
                    base: appConfig.app.root
                }
            },
            dist: {
                options: {
                    open: true,
                    base: appConfig.dist.root
                }
            }
        },

        jshint: {
            options: {
                jshintrc: true,
                reporter: require('jshint-stylish')
            },
            appFiles: [
                'Gruntfile.js',
                appConfig.app.files.js.all
            ],
            testFiles: {
                src: appConfig.app.files.spec
            }
        },

        clean: {
            tmp: appConfig.tmp.root,
            dist: appConfig.dist.root
        },

        wiredep: {
            index: {
                src: appConfig.app.files.index
            }
        },

        copy: {
            html: {
                src: appConfig.app.files.index,
                dest: appConfig.dist.files.index
            },
            images: {
                files: [{
                    expand: true,
                    cwd: appConfig.app.root,
                    src: appConfig.app.files.images.relative,
                    dest: appConfig.dist.root
                }]
            }
        },

        useminPrepare: {
            html: appConfig.app.files.index,
            options: {
                dest: appConfig.dist.root
            }
        },

        html2js: {
            templateCache: {
                options: {
                    base: appConfig.app.root,
                    htmlmin: appConfig.htmlminOptions,
                    module: appConfig.templateCache.module,
                    singleModule: true,
                    useStrict: true,
                    quoteChar: '\''
                },
                src: appConfig.app.files.html.views,
                dest: appConfig.tmp.files.templateCache
            }
        },

        concat: {
            templateCache: {
                src: [
                    appConfig.tmp.files.app,
                    appConfig.tmp.files.templateCache
                ],
                dest: appConfig.tmp.files.app
            }
        },

        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            dist: {
                src: appConfig.tmp.files.app,
                dest: appConfig.tmp.files.app
            }
        },

        filerev: {
            dist: {
                src: [
                    appConfig.dist.files.js.all,
                    appConfig.dist.files.css,
                    appConfig.dist.files.images.full
                ]
            }
        },

        usemin: {
            html: appConfig.dist.files.index,
            js: appConfig.dist.files.js.app,
            css: appConfig.dist.files.css,
            options: {
                assetsDirs: appConfig.dist.root,
                patterns: {
                    js: [[
                        /["'=](\S+\.(?:svg|png)).?['"]?/g,
                        'Update new img filenames (within js files)'
                    ]],
                    html: [[
                        /<md-icon[^\>]*[^\>\S]+md-svg-src=['"]([^'"\)#]+)(#.+)?["']/gm,
                        'Update the HTML with non standard md-svg-src on md-icon'
                    ]]
                }
            }
        },

        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: appConfig.dist.dirs.images,
                    src: appConfig.dist.files.images.relative,
                    dest: appConfig.dist.dirs.images
                }]
            }
        },

        htmlmin: {
            dist: {
                src: appConfig.dist.files.index,
                options: appConfig.htmlminOptions,
                dest: appConfig.dist.files.index
            }
        },

        karma: {
            options: {
                singleRun: true, // set to false to debug in browser
                frameworks: ['jasmine'],
                browsers: [
                    'Chrome',
                    'Firefox',
                    'PhantomJS'
                ],
                plugins: [
                    'karma-jasmine',
                    'karma-chrome-launcher',
                    'karma-firefox-launcher',
                    'karma-phantomjs-launcher',
                    'karma-ng-html2js-preprocessor'
                ]
            },
            app: {
                preprocessors: {
                    '**/*.html': ['ng-html2js']
                },
                ngHtml2JsPreprocessor: {
                    stripPrefix: appConfig.app.root + '/',
                    moduleName: appConfig.templateCache.module
                },
                files: [{
                    src: [
                        appConfig.app.files.js.deps,
                        appConfig.app.files.js.mocks,
                        appConfig.app.files.js.modules,
                        appConfig.app.files.js.all,
                        appConfig.app.files.html.views // needed for html2js
                    ]
                }]
            },
            dist: {
                files: [{
                    src: [
                        appConfig.dist.files.js.lib,
                        appConfig.dist.files.js.app,
                        appConfig.app.files.js.mocks,
                        appConfig.app.files.spec
                    ]
                }]
            }
        }
    });
};
<commit_msg>not really using livereload anymore, especially when needing to test locally on https through ngrok<commit_after>'use strict';

module.exports = function (grunt) {
    grunt.registerTask('default', [
        'init',
        'test:app',
        'serve'
    ]);

    grunt.registerTask('init', 'ensure customizable files are in place', function () {
        initialize('/favicon.ico');
        initialize('/images/logo.png');
        initialize('/password.env.js');
        initialize('/password.config.theme.js');
    });

    grunt.registerTask('test', 'tests the app in different states, e.g., app or dist forms', function (appState) {
        grunt.task.run('jshint:testFiles');
        grunt.task.run('karma' + (appState ? ':' + appState : ''));
    });

    grunt.registerTask('dist', [
        'clean',
        'init',
        'wiredep',
        'jshint:appFiles',
        'useminPrepare',
        'html2js',
        'concat:generated',
        'replace:templateCache',
        'concat:templateCache',
        'ngAnnotate',
        'uglify',
        'cssmin',
        'copy',
        'imagemin',
        'filerev',
        'usemin',
        'htmlmin'
    ]);

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

        grunt.task.run([
            'wiredep',
            'connect:dev',
            'watch'
        ]);
    });

    var appConfig = {
        app: {
            root: 'app',
            files: {
                css: [
                    '<%= passwordConfig.app.root %>/*.css',
                    '<%= passwordConfig.app.root %>/!(bower_components)/**/*.css'
                ],
                html: {
                    all: [
                        '<%= passwordConfig.app.root %>/*.html',
                        '<%= passwordConfig.app.files.html.views %>'
                    ],
                    views: '<%= passwordConfig.app.root %>/!(bower_components)/**/*.html'
                },
                images: {
                    full: '<%= passwordConfig.app.root %>/images/**/*.{png,svg}',
                    relative: [
                        '*.ico',
                        'images/**/*.{png,svg}'
                    ]
                },
                index: '<%= passwordConfig.app.root %>/index.html',
                js: {
                    all: [
                        '<%= passwordConfig.app.root %>/*.js',
                        '<%= passwordConfig.app.root %>/!(bower_components)/**/*.js'
                    ],
                    modules: [
                        '<%= passwordConfig.app.root %>/*.module.js',
                        '<%= passwordConfig.app.root %>/!(bower_components)/**/*.module.js'
                    ],
                    deps: [
                        '<%= passwordConfig.app.root %>/bower_components/angular/angular.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-route/angular-route.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-material/angular-material.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-animate/angular-animate.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-aria/angular-aria.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-messages/angular-messages.js',
                        '<%= passwordConfig.app.root %>/bower_components/angularytics/dist/angularytics.min.js'
                    ],
                    mocks: [
                        '<%= passwordConfig.app.root %>/bower_components/angular-mocks/angular-mocks.js',
                        '<%= passwordConfig.app.root %>/bower_components/angular-material/angular-material-mocks.js'
                    ]
                },
                spec: [
                    '<%= passwordConfig.app.root %>/*.spec.js',
                    '<%= passwordConfig.app.root %>/!(bower_components)/**/*.spec.js'
                ]
            }
        },
        dist: {
            root: 'dist',
            dirs: {
                images: '<%= passwordConfig.dist.root %>/images'
            },
            files: {
                css: '<%= passwordConfig.dist.root %>/styles/*.css',
                images: {
                    full: [
                        '<%= passwordConfig.dist.root %>/*.ico',
                        '<%= passwordConfig.dist.root %>/images/**/*.{png,svg}'
                    ],
                    relative: [
                        '*.ico',
                        '**/*.{png,svg}'
                    ]
                },
                index: '<%= passwordConfig.dist.root %>/index.html',
                js: {
                    all: '<%= passwordConfig.dist.root %>/scripts/*.js',
                    app: [
                        '<%= passwordConfig.dist.root %>/scripts/password.env.*.js',
                        '<%= passwordConfig.dist.root %>/scripts/password.*.js'
                    ],
                    lib: '<%= passwordConfig.dist.root %>/scripts/lib.*.js'
                }
            }
        },
        tmp: {
            root: '.tmp',
            dirs: {
                specs: '<%= passwordConfig.tmp.root %>/specs',
                scripts: '<%= passwordConfig.tmp.root %>/concat/scripts'
            },
            files: {
                app: '<%= passwordConfig.tmp.dirs.scripts %>/password.js',
                templateCache: '<%= passwordConfig.tmp.dirs.scripts %>/templates.js'
            }
        },
        htmlminOptions: {
            collapseBooleanAttributes: true,
            collapseWhitespace: true,
            conservativeCollapse: true,
            removeAttributeQuotes: true,
            removeComments: true,
            removeCommentsFromCDATA: true,
            removeEmptyAttributes: true,
            removeIgnored: true,
            removeOptionalTags: true,
            removeRedundantAttributes: true,
            removeScriptTypeAttributes: true,
            removeStyleLinkTypeAttributes: true
        },
        templateCache: {
            module: 'password.templates'
        }
    };

    grunt.registerTask('backend', 'determine which backend to put in place', function (type) {
          if (type === 'mock') {
              grunt.file.copy(appConfig.app.root + '/password.env.mock.js',
                              appConfig.app.root + '/password.env.js');

              grunt.log.ok('mock backend in place.');
          } else {
              grunt.file.delete(appConfig.app.root + '/password.env.js');

              grunt.task.run(['init']);

              grunt.log.ok('default backend in place.');
          }
    });

    function initialize(file) {
        var destpath = appConfig.app.root + file;

        if (grunt.file.exists(destpath)) {
            grunt.log.error(destpath + ' already initialized.');
        } else {
            var lastDot = /\.(?=[^.]*$)/,
                defaultFile = destpath.replace(lastDot, '.default.');

            grunt.file.copy(defaultFile,  destpath);

            grunt.log.ok(destpath + ' absent, initialized from ' + defaultFile + '.');
        }
    }

    require('load-grunt-tasks')(grunt);

    require('time-grunt')(grunt);

    grunt.initConfig({
        passwordConfig: appConfig,

        replace: {
            templateCache: {
                src: appConfig.tmp.files.app,
                options: {
                    patterns: [{
                        match: /\/\*@@DIST-TEMPLATE-CACHE\*\//,
                        replacement: '\'' + appConfig.templateCache.module + '\','
                    }]
                },
                dest: appConfig.tmp.files.app
            }
        },

        watch: {
            js: {
                files: appConfig.app.files.js.all,
                tasks: ['newer:jshint:appFiles']
            },
            test: {
                files: appConfig.app.files.spec,
                tasks: ['newer:jshint:testFiles', 'test:app']
            }
        },

        connect: {
            options: {
                port: 9000,
                open: true
            },
            dev: {
                options: {
                    base: appConfig.app.root
                }
            },
            dist: {
                options: {
                    base: appConfig.dist.root
                }
            }
        },

        jshint: {
            options: {
                jshintrc: true,
                reporter: require('jshint-stylish')
            },
            appFiles: [
                'Gruntfile.js',
                appConfig.app.files.js.all
            ],
            testFiles: {
                src: appConfig.app.files.spec
            }
        },

        clean: {
            tmp: appConfig.tmp.root,
            dist: appConfig.dist.root
        },

        wiredep: {
            index: {
                src: appConfig.app.files.index
            }
        },

        copy: {
            html: {
                src: appConfig.app.files.index,
                dest: appConfig.dist.files.index
            },
            images: {
                files: [{
                    expand: true,
                    cwd: appConfig.app.root,
                    src: appConfig.app.files.images.relative,
                    dest: appConfig.dist.root
                }]
            }
        },

        useminPrepare: {
            html: appConfig.app.files.index,
            options: {
                dest: appConfig.dist.root
            }
        },

        html2js: {
            templateCache: {
                options: {
                    base: appConfig.app.root,
                    htmlmin: appConfig.htmlminOptions,
                    module: appConfig.templateCache.module,
                    singleModule: true,
                    useStrict: true,
                    quoteChar: '\''
                },
                src: appConfig.app.files.html.views,
                dest: appConfig.tmp.files.templateCache
            }
        },

        concat: {
            templateCache: {
                src: [
                    appConfig.tmp.files.app,
                    appConfig.tmp.files.templateCache
                ],
                dest: appConfig.tmp.files.app
            }
        },

        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            dist: {
                src: appConfig.tmp.files.app,
                dest: appConfig.tmp.files.app
            }
        },

        filerev: {
            dist: {
                src: [
                    appConfig.dist.files.js.all,
                    appConfig.dist.files.css,
                    appConfig.dist.files.images.full
                ]
            }
        },

        usemin: {
            html: appConfig.dist.files.index,
            js: appConfig.dist.files.js.app,
            css: appConfig.dist.files.css,
            options: {
                assetsDirs: appConfig.dist.root,
                patterns: {
                    js: [[
                        /["'=](\S+\.(?:svg|png)).?['"]?/g,
                        'Update new img filenames (within js files)'
                    ]],
                    html: [[
                        /<md-icon[^\>]*[^\>\S]+md-svg-src=['"]([^'"\)#]+)(#.+)?["']/gm,
                        'Update the HTML with non standard md-svg-src on md-icon'
                    ]]
                }
            }
        },

        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: appConfig.dist.dirs.images,
                    src: appConfig.dist.files.images.relative,
                    dest: appConfig.dist.dirs.images
                }]
            }
        },

        htmlmin: {
            dist: {
                src: appConfig.dist.files.index,
                options: appConfig.htmlminOptions,
                dest: appConfig.dist.files.index
            }
        },

        karma: {
            options: {
                singleRun: true, // set to false to debug in browser
                frameworks: ['jasmine'],
                browsers: [
                    'Chrome',
                    'Firefox',
                    'PhantomJS'
                ],
                plugins: [
                    'karma-jasmine',
                    'karma-chrome-launcher',
                    'karma-firefox-launcher',
                    'karma-phantomjs-launcher',
                    'karma-ng-html2js-preprocessor'
                ]
            },
            app: {
                preprocessors: {
                    '**/*.html': ['ng-html2js']
                },
                ngHtml2JsPreprocessor: {
                    stripPrefix: appConfig.app.root + '/',
                    moduleName: appConfig.templateCache.module
                },
                files: [{
                    src: [
                        appConfig.app.files.js.deps,
                        appConfig.app.files.js.mocks,
                        appConfig.app.files.js.modules,
                        appConfig.app.files.js.all,
                        appConfig.app.files.html.views // needed for html2js
                    ]
                }]
            },
            dist: {
                files: [{
                    src: [
                        appConfig.dist.files.js.lib,
                        appConfig.dist.files.js.app,
                        appConfig.app.files.js.mocks,
                        appConfig.app.files.spec
                    ]
                }]
            }
        }
    });
};
<|endoftext|>