<commit_before>/* global require, process */
/* jshint onevar:false, maxlen:100 */
module.exports = function (grunt) {
    'use strict';

    // require it at the top and pass in the grunt instance
    require('time-grunt')(grunt);

    var matchdep = require('matchdep'),
        path = require('path'),
        meta = grunt.file.readJSON('./bower.json')
    ;

    var asimoveCorePath = path.resolve(meta.name === 'asimov-core' ?
        '.' :
        './bower_components/asimov-core');

    // Create an array of asimov deps
    //
    // Since bower installs dep flat rather than nested (npm style) we can use
    // simple globbing. Alternative we could use bower.commands.list.
    var bowerDeps = grunt.file.glob.sync('bower_components/asimov-*');

    // Create a array of paths to be passed to sass' --load-path
    //
    // This allows us to use @import bowered in components' sass files as if
    // they were part of your local component/theme.
    var sassLoadPaths = ['src/scss'].concat(bowerDeps.map(function (depPath) {
        return path.join(depPath, 'src', 'scss');
    }));

    // RequireJS task settings
    //
    // If we're compiling asimov-core then we only need to compile the one file
    // If we're compiling themes or components we need to walk directories to
    // find what modules we need to build
    var rjsOptions = {};
    if (meta.name === 'asimov-core') {
        rjsOptions = {
            core: {
                options: {
                    baseUrl: 'src/js',
                    name: 'asimov/core',
                    out: 'dist/js/asimov/core.js'
                }
            }
        };
    } else {
        rjsOptions = {
            modules: {
                options: {
                    baseUrl: 'src/js',
                    dir: 'dist/js',
                    // wrap: {
                    //     startFile: '<%= asimov.core %>/build/js/intro.js',
                    //     endFile: '<%= asimov.core %>/build/js/outro.js'
                    // },
                    modules: grunt.file.expand({ cwd: 'src/js' }, '*.js')
                        .map(function (file) {
                            return { name: file.replace(/\.js$/, '') };
                        })
                }
            }
        };
    }

    grunt.initConfig({
        pkg: grunt.file.readJSON('bower.json'),
        jshintrc: grunt.file.readJSON(asimoveCorePath + '/.jshintrc'),

        // Project settings

        asimov: {
            core: asimoveCorePath,
            src: '<%= asimov.core %>/src'
        },

        // Remove generated files

        clean: {
            dist: ['dist/*'],
            docs: ['docs/*'],
            build: ['.build/*']
        },

        // RequireJS

        requirejs: grunt.util._.extend({
            options: {
                logLevel: 3,
                optimize: 'none',
                keepBuildDir: false,
                skipModuleInsertion: true,
                removeCombined: true,
                paths: {
                    jquery: 'empty:',
                    asimov: '<%= asimov.src %>/js/asimov'
                }
            }
        }, rjsOptions),

        // Sass compilation

        sass: {
            options: {
                style: 'expanded',
                lineNumbers: false,
                loadPath: sassLoadPaths,
                cacheLocation: '.build/.sass-cache'
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'tests/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: '.build/sasstest',
                    ext: '.css'
                }]
            },
            docs: {
                files: [{
                    expand: true,
                    cwd: '<%= asimov.src %>/docs/assets/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'docs/assets/css',
                    ext: '.css'
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'dist/css',
                    ext: '.css'
                }]
            }
        },

        autoprefixer: {
            options: {
                browsers: ['last 2 version', 'ie 8', 'ie 9']
            },
            dist: {
                src: 'dist/css/*!(.min).css'
            }
        },

        // Create minified versions of the dist files

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

        uglify: {
            dist: {
                expand: true,
                cwd: 'dist/js',
                src: ['**/*.js', '!*.min.js'],
                dest: 'dist/js',
                ext: '.min.js'
            }
        },

        // Generate the docs

        symlink: grunt.util._.extend({
            core: {
                src: path.join(asimoveCorePath, 'dist'),
                dest: 'docs/assets/asimov-core'
            }
        }, (meta.name === 'asimov-core' ? {} : {
            docs: {
                src: 'dist',
                dest: 'docs/assets/<%= pkg.name %>'
            }
        })),

        template: {
            docs: {
                options: {
                    data: function () {
                        return {
                            styles: grunt.file.expand({ cwd: 'docs/assets' }, [
                                'asimov-!(core)/css/**/*.css',
                                '!**/*.min.css'
                            ]),
                            scripts: grunt.file.expand({ cwd: 'docs/assets' }, [
                                'asimov-!(core)/js/{*,/}*.js',
                                '!**/*.min.js'
                            ])
                        };
                    }
                },
                files: {
                    '.build/docs/index.html': ['<%= asimov.src %>/docs/index.html'],
                    '.build/docs/styleguide.md': ['<%= asimov.src %>/docs/styleguide.md']
                }
            }
        },

        sync: {
            docs: {
                files: [{
                    cwd: '<%= asimov.src %>/docs/assets',
                    src: ['**', '!scss/**'],
                    dest: 'docs/assets'
                }]
            }
        },

        exec: {
            docs: {
                cmd: [
                    '<%= asimov.core %>/node_modules/.bin/distancss',
                    'dist/css',
                    'docs',
                    '--template',
                    '.build/docs',
                    '--public',
                    '/assets'
                ].join(' ')
            }
        },

        // Docs server

        connect: {
            options: {
                base: 'docs',
                keepalive: true,
                port: 9001
            },
            dev: {}
        },

        // Run our sass tests

        sasstest: {
            test: {}
        },

        // Javscript QA
        //
        // 1: wash our hands of 3rd party assets
        // 2: allow for debug code when in dev

        jsvalidate: {
            dist: ['src/js/**/*.js'],
            docs: [
                'src/docs/assets/js/**/*.js',
                '!**/vendor/**'                 // 1
            ]
        },

        jshint: {
            options: '<%= jshintrc %>',
            dist: ['<%= jsvalidate.dist %>'],
            docs: ['<%= jsvalidate.docs %>']
        },

        gjslint: {
            options: {
                flags: [
                    '--disable 110,13'
                ],
                reporter: {
                    name: 'console'
                }
            },
            dist: ['<%= jsvalidate.dist %>'],
            docs: ['<%= jsvalidate.docs %>']
        },

        // Developement watch task

        watch: {
            options: {
                debounceDelay: 100,
                spawn: false
            },
            sass: {
                files: ['src/scss/**/*.scss', '!src/docs/assets/scss/**'],
                tasks: ['build-styles:dev', 'build-docs:dev']
            },
            js: {
                files: ['src/js/**/*.js', '!src/docs/assets/js/**'],
                tasks: ['build-scripts:dev', 'build-docs:dev']
            }
        },

        concurrent: {
            target: {
                tasks: ['connect:dev', 'watch'],
                options: {
                    logConcurrentOutput: true
                }
            }
        },

        // Creating new releases

        bump: {
            options: {
                files: ['bower.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(release): release v%VERSION%',
                commitFiles: ['bower.json', '<%= changelog.options.dest %>'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'tagging version %VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        // Automatic changelogs

        changelog: {
            options: {
                dest: 'CHANGELOG.md',
                prepend: true,
                github: grunt.file.readJSON('./bower.json').version,
                editor: 'subl -w'
            }
        },

        // Creating new releases

        release: {
            dryRun: false
        }
    });

    // Load tasks defined in asimov-core's package.json

    var base = process.cwd();
    matchdep.filterAll('grunt-!(cli)', asimoveCorePath + '/package.json')
        .forEach(function (task) {
            // need to temporarily change base for grunt.loadNpmTasks to work
            grunt.file.setBase(asimoveCorePath);
            grunt.loadNpmTasks(task);
            grunt.file.setBase(base);
        });

    // Load our custom tasks

    grunt.loadTasks(asimoveCorePath + '/build/tasks');

    // Public tasks

    // grunt.registerTask('dev', [
    //     'clean',
    //     'validate',
    //     meta.name === 'asimov-core' ? 'compile':  'docs',
    //     'concurrent'
    // ]);

    grunt.registerTask('dev', [
        'clean',
        'build-scripts:dev',
        'build-styles:dev',
        'build-docs:dev',
        'concurrent'
    ]);

    grunt.registerTask('default', [
        'clean',
        'build-scripts:prod',
        'build-styles:prod',
        'build-docs:prod'
    ]);
};
<commit_msg>feat(build): use a component's .jshintrc if it exists<commit_after>/* global require, process */
/* jshint onevar:false, maxlen:100 */
module.exports = function (grunt) {
    'use strict';

    // require it at the top and pass in the grunt instance
    require('time-grunt')(grunt);

    var matchdep = require('matchdep'),
        path = require('path'),
        meta = grunt.file.readJSON('./bower.json')
    ;

    var asimoveCorePath = path.resolve(meta.name === 'asimov-core' ?
        '.' :
        './bower_components/asimov-core');

    // Create an array of asimov deps
    //
    // Since bower installs dep flat rather than nested (npm style) we can use
    // simple globbing. Alternative we could use bower.commands.list.
    var bowerDeps = grunt.file.glob.sync('bower_components/asimov-*');

    // Create a array of paths to be passed to sass' --load-path
    //
    // This allows us to use @import bowered in components' sass files as if
    // they were part of your local component/theme.
    var sassLoadPaths = ['src/scss'].concat(bowerDeps.map(function (depPath) {
        return path.join(depPath, 'src', 'scss');
    }));

    // RequireJS task settings
    //
    // If we're compiling asimov-core then we only need to compile the one file
    // If we're compiling themes or components we need to walk directories to
    // find what modules we need to build
    var rjsOptions = {};
    if (meta.name === 'asimov-core') {
        rjsOptions = {
            core: {
                options: {
                    baseUrl: 'src/js',
                    name: 'asimov/core',
                    out: 'dist/js/asimov/core.js'
                }
            }
        };
    } else {
        rjsOptions = {
            modules: {
                options: {
                    baseUrl: 'src/js',
                    dir: 'dist/js',
                    // wrap: {
                    //     startFile: '<%= asimov.core %>/build/js/intro.js',
                    //     endFile: '<%= asimov.core %>/build/js/outro.js'
                    // },
                    modules: grunt.file.expand({ cwd: 'src/js' }, '*.js')
                        .map(function (file) {
                            return { name: file.replace(/\.js$/, '') };
                        })
                }
            }
        };
    }

    grunt.initConfig({
        pkg: grunt.file.readJSON('bower.json'),
        jshintrc: grunt.file.exists('.jshintrc') ?
            grunt.file.readJSON('.jshintrc') :
            grunt.file.readJSON(asimoveCorePath + '/.jshintrc'),

        // Project settings

        asimov: {
            core: asimoveCorePath,
            src: '<%= asimov.core %>/src'
        },

        // Remove generated files

        clean: {
            dist: ['dist/*'],
            docs: ['docs/*'],
            build: ['.build/*']
        },

        // RequireJS

        requirejs: grunt.util._.extend({
            options: {
                logLevel: 3,
                optimize: 'none',
                keepBuildDir: false,
                skipModuleInsertion: true,
                removeCombined: true,
                paths: {
                    jquery: 'empty:',
                    asimov: '<%= asimov.src %>/js/asimov'
                }
            }
        }, rjsOptions),

        // Sass compilation

        sass: {
            options: {
                style: 'expanded',
                lineNumbers: false,
                loadPath: sassLoadPaths,
                cacheLocation: '.build/.sass-cache'
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'tests/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: '.build/sasstest',
                    ext: '.css'
                }]
            },
            docs: {
                files: [{
                    expand: true,
                    cwd: '<%= asimov.src %>/docs/assets/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'docs/assets/css',
                    ext: '.css'
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'dist/css',
                    ext: '.css'
                }]
            }
        },

        autoprefixer: {
            options: {
                browsers: ['last 2 version', 'ie 8', 'ie 9']
            },
            dist: {
                src: 'dist/css/*!(.min).css'
            }
        },

        // Create minified versions of the dist files

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

        uglify: {
            dist: {
                expand: true,
                cwd: 'dist/js',
                src: ['**/*.js', '!*.min.js'],
                dest: 'dist/js',
                ext: '.min.js'
            }
        },

        // Generate the docs

        symlink: grunt.util._.extend({
            core: {
                src: path.join(asimoveCorePath, 'dist'),
                dest: 'docs/assets/asimov-core'
            }
        }, (meta.name === 'asimov-core' ? {} : {
            docs: {
                src: 'dist',
                dest: 'docs/assets/<%= pkg.name %>'
            }
        })),

        template: {
            docs: {
                options: {
                    data: function () {
                        return {
                            styles: grunt.file.expand({ cwd: 'docs/assets' }, [
                                'asimov-!(core)/css/**/*.css',
                                '!**/*.min.css'
                            ]),
                            scripts: grunt.file.expand({ cwd: 'docs/assets' }, [
                                'asimov-!(core)/js/{*,/}*.js',
                                '!**/*.min.js'
                            ])
                        };
                    }
                },
                files: {
                    '.build/docs/index.html': ['<%= asimov.src %>/docs/index.html'],
                    '.build/docs/styleguide.md': ['<%= asimov.src %>/docs/styleguide.md']
                }
            }
        },

        sync: {
            docs: {
                files: [{
                    cwd: '<%= asimov.src %>/docs/assets',
                    src: ['**', '!scss/**'],
                    dest: 'docs/assets'
                }]
            }
        },

        exec: {
            docs: {
                cmd: [
                    '<%= asimov.core %>/node_modules/.bin/distancss',
                    'dist/css',
                    'docs',
                    '--template',
                    '.build/docs',
                    '--public',
                    '/assets'
                ].join(' ')
            }
        },

        // Docs server

        connect: {
            options: {
                base: 'docs',
                keepalive: true,
                port: 9001
            },
            dev: {}
        },

        // Run our sass tests

        sasstest: {
            test: {}
        },

        // Javscript QA
        //
        // 1: wash our hands of 3rd party assets
        // 2: allow for debug code when in dev

        jsvalidate: {
            dist: ['src/js/**/*.js'],
            docs: [
                'src/docs/assets/js/**/*.js',
                '!**/vendor/**'                 // 1
            ]
        },

        jshint: {
            options: '<%= jshintrc %>',
            dist: ['<%= jsvalidate.dist %>'],
            docs: ['<%= jsvalidate.docs %>']
        },

        gjslint: {
            options: {
                flags: [
                    '--disable 110,13'
                ],
                reporter: {
                    name: 'console'
                }
            },
            dist: ['<%= jsvalidate.dist %>'],
            docs: ['<%= jsvalidate.docs %>']
        },

        // Developement watch task

        watch: {
            options: {
                debounceDelay: 100,
                spawn: false
            },
            sass: {
                files: ['src/scss/**/*.scss', '!src/docs/assets/scss/**'],
                tasks: ['build-styles:dev', 'build-docs:dev']
            },
            js: {
                files: ['src/js/**/*.js', '!src/docs/assets/js/**'],
                tasks: ['build-scripts:dev', 'build-docs:dev']
            }
        },

        concurrent: {
            target: {
                tasks: ['connect:dev', 'watch'],
                options: {
                    logConcurrentOutput: true
                }
            }
        },

        // Creating new releases

        bump: {
            options: {
                files: ['bower.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(release): release v%VERSION%',
                commitFiles: ['bower.json', '<%= changelog.options.dest %>'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'tagging version %VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        // Automatic changelogs

        changelog: {
            options: {
                dest: 'CHANGELOG.md',
                prepend: true,
                github: grunt.file.readJSON('./bower.json').version,
                editor: 'subl -w'
            }
        },

        // Creating new releases

        release: {
            dryRun: false
        }
    });

    // Load tasks defined in asimov-core's package.json

    var base = process.cwd();
    matchdep.filterAll('grunt-!(cli)', asimoveCorePath + '/package.json')
        .forEach(function (task) {
            // need to temporarily change base for grunt.loadNpmTasks to work
            grunt.file.setBase(asimoveCorePath);
            grunt.loadNpmTasks(task);
            grunt.file.setBase(base);
        });

    // Load our custom tasks

    grunt.loadTasks(asimoveCorePath + '/build/tasks');

    // Public tasks

    // grunt.registerTask('dev', [
    //     'clean',
    //     'validate',
    //     meta.name === 'asimov-core' ? 'compile':  'docs',
    //     'concurrent'
    // ]);

    grunt.registerTask('dev', [
        'clean',
        'build-scripts:dev',
        'build-styles:dev',
        'build-docs:dev',
        'concurrent'
    ]);

    grunt.registerTask('default', [
        'clean',
        'build-scripts:prod',
        'build-styles:prod',
        'build-docs:prod'
    ]);
};
<|endoftext|>


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

    "use strict";

    var coreFiles = [
        "resource-bundle.js",
        "locale.js",
        "currency-data.js",
        "currency.js",
        "field-position.js",
        "parse-position.js",
        "format.js"
    ];

    var numberFormatFiles = [
        "number-format.js",
        "digit-list.js",
        "decimal-format-symbols.js",
        "decimal-format.js",
        "choice-format.js"
    ];

    var dateFormatFiles = [
        "calendar-helper.js",
        "date-format-symbols.js",
        "date-format.js",
        "simple-date-format.js"
    ];

    var messageFormatFiles = [
        "message-format.js"
    ];

    var sourceFiles = coreFiles
        .concat( numberFormatFiles )
        .concat( dateFormatFiles )
        .concat( messageFormatFiles )
        .map( function( file ) {
        return "src/" + file;
    } );

    grunt.initConfig( {

        pkg: grunt.file.readJSON( "package.json" ),

        clean: {
            dist: "dist/",
            lib: "lib/"
        },

        copy: {
            main: {
                expand: true,
                cwd: "src/",
                src: "**",
                dest: "lib/"
            }
        },

        npmcopy: {
            external: {
                options: {
                    destPrefix: "external/"
                },
                files: {
                    "text-resources": "text-resources/dist/**/*.js"
                }
            }
        },

        uglify: {
            options: {
                mangle: {
                    except: [
                        "CalendarHelper",
                        "ChoiceFormat",
                        "Currency",
                        "DateFormat",
                        "DateFormatSymbols",
                        "DecimalFormat",
                        "DecimalFormatSymbols",
                        "DigitList",
                        "FieldPosition",
                        "ParsePosition",
                        "Format",
                        "Locale",
                        "MessageFormat",
                        "NumberFormat",
                        "ResourceBundle",
                        "SimpleDateFormat"
                    ]
                },
                ASCIIOnly: true,
                banner: "/*! <%=pkg.name %> | <%= pkg.version %> | <%= grunt.template.today('yyyy-mm-dd') %> */\n"
            },
            main: {
                options: {
                    mangle: false,
                    compress: false,
                    beautify: true,
                    preserveComments: "all"
                },
                files: {
                    "dist/text-format.js": sourceFiles
                }
            },
            dist: {
                options: {
                    sourceMap: true
                },
                files: {
                    "dist/text-format.min.js": "dist/text-format.js"
                }
            }
        },

        qunit: {
            all: [ "test/unit/*/**/*.html" ]
        }

    } );

    grunt.loadNpmTasks( "grunt-contrib-clean" );
    grunt.loadNpmTasks( "grunt-contrib-copy" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-qunit" );
    grunt.loadNpmTasks( "grunt-npmcopy" );

    grunt.registerTask( "default", [ "clean", "copy", "uglify:main", "uglify:dist" ] );
    grunt.registerTask( "test", [ "qunit" ] );

};<commit_msg>Add text-resources base file in dist directory<commit_after>module.exports = function( grunt ) {

    "use strict";

    var coreFiles = [
        "resource-bundle.js",
        "locale.js",
        "currency-data.js",
        "currency.js",
        "field-position.js",
        "parse-position.js",
        "format.js"
    ];

    var numberFormatFiles = [
        "number-format.js",
        "digit-list.js",
        "decimal-format-symbols.js",
        "decimal-format.js",
        "choice-format.js"
    ];

    var dateFormatFiles = [
        "calendar-helper.js",
        "date-format-symbols.js",
        "date-format.js",
        "simple-date-format.js"
    ];

    var messageFormatFiles = [
        "message-format.js"
    ];

    var sourceFiles = coreFiles
        .concat( numberFormatFiles )
        .concat( dateFormatFiles )
        .concat( messageFormatFiles )
        .map( function( file ) {
        return "src/" + file;
    } );

    grunt.initConfig( {

        pkg: grunt.file.readJSON( "package.json" ),

        clean: {
            dist: "dist/",
            lib: "lib/"
        },

        copy: {
            main: {
                expand: true,
                cwd: "src/",
                src: "**",
                dest: "lib/"
            }
        },

        npmcopy: {
            external: {
                options: {
                    destPrefix: "external/"
                },
                files: {
                    "text-resources": "text-resources/dist/**/*.js"
                }
            }
        },

        uglify: {
            options: {
                mangle: {
                    except: [
                        "CalendarHelper",
                        "ChoiceFormat",
                        "Currency",
                        "DateFormat",
                        "DateFormatSymbols",
                        "DecimalFormat",
                        "DecimalFormatSymbols",
                        "DigitList",
                        "FieldPosition",
                        "ParsePosition",
                        "Format",
                        "Locale",
                        "MessageFormat",
                        "NumberFormat",
                        "ResourceBundle",
                        "SimpleDateFormat"
                    ]
                },
                ASCIIOnly: true,
                banner: "/*! <%=pkg.name %> | <%= pkg.version %> | <%= grunt.template.today('yyyy-mm-dd') %> */\n"
            },
            main: {
                options: {
                    mangle: false,
                    compress: false,
                    beautify: true,
                    preserveComments: "all"
                },
                files: {
                    "dist/text-format.js": sourceFiles,
                    "dist/text-resources.js": "external/text-resources/text-resources.js"
                }
            },
            dist: {
                options: {
                    sourceMap: true
                },
                files: {
                    "dist/text-format.min.js": "dist/text-format.js",
                    "dist/text-resources.min.js": "dist/text-resources.js"
                }
            }
        },

        qunit: {
            all: [ "test/unit/*/**/*.html" ]
        }

    } );

    grunt.loadNpmTasks( "grunt-contrib-clean" );
    grunt.loadNpmTasks( "grunt-contrib-copy" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-qunit" );
    grunt.loadNpmTasks( "grunt-npmcopy" );

    grunt.registerTask( "default", [ "clean", "copy", "uglify:main", "uglify:dist" ] );
    grunt.registerTask( "test", [ "qunit" ] );

};<|endoftext|>


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

  grunt.initConfig({
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'assets/js/*.js',
        'assets/js/plugins/*.js'
      ]
    },
    recess: {
      dist: {
        options: {
          compile: true,
          compress: true
        },
        files: {
          'css/app.min.css': [
            'assets/less/app.less'
          ]
        }
      }
    },
    sass: {
      dist: {
        files: {
          'css/app.min.css' : [
            'assets/scss/app.scss'
          ]
        }
      },
      options: {
        style: 'compressed'
      }
    },
    uglify: {
      dist: {
        files: {
          'js/scripts.min.js': [
            'assets/js/plugins/*.js',
            'assets/js/_*.js'
          ]
        }
      }
    },
    watch: {
      less: {
        files: [
          'assets/less/*.less'
        ],
        tasks: ['recess']
      },
      css: {
        files: [
          'assets/scss/*.scss'
        ],
        tasks: ['sass']
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify']
      },
      livereload: {
        // Browser live reloading
        // https://github.com/gruntjs/grunt-contrib-watch#live-reloading
        options: {
          livereload: false
        },
        files: [
          'css/main.min.css',
          'js/scripts.min.js',
          'templates/*.html',
          '*.html'
        ]
      }
    },
    clean: {
      dist: [
        'css/main.min.css',
        'js/scripts.min.js'
      ]
    }
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-recess');

  // Register tasks
  grunt.registerTask('default', [
    'clean',
    'recess',
    //'sass',
    'uglify'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<commit_msg>remove gruntfile itself from jshint run<commit_after>'use strict';
module.exports = function(grunt) {

  grunt.initConfig({
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'assets/js/*.js',
        'assets/js/plugins/*.js'
      ]
    },
    recess: {
      dist: {
        options: {
          compile: true,
          compress: true
        },
        files: {
          'css/app.min.css': [
            'assets/less/app.less'
          ]
        }
      }
    },
    sass: {
      dist: {
        files: {
          'css/app.min.css' : [
            'assets/scss/app.scss'
          ]
        }
      },
      options: {
        style: 'compressed'
      }
    },
    uglify: {
      dist: {
        files: {
          'js/scripts.min.js': [
            'assets/js/plugins/*.js',
            'assets/js/_*.js'
          ]
        }
      }
    },
    watch: {
      less: {
        files: [
          'assets/less/*.less'
        ],
        tasks: ['recess']
      },
      css: {
        files: [
          'assets/scss/*.scss'
        ],
        tasks: ['sass']
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify']
      },
      livereload: {
        // Browser live reloading
        // https://github.com/gruntjs/grunt-contrib-watch#live-reloading
        options: {
          livereload: false
        },
        files: [
          'css/main.min.css',
          'js/scripts.min.js',
          'templates/*.html',
          '*.html'
        ]
      }
    },
    clean: {
      dist: [
        'css/main.min.css',
        'js/scripts.min.js'
      ]
    }
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-recess');

  // Register tasks
  grunt.registerTask('default', [
    'clean',
    'recess',
    //'sass',
    'uglify'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  // Include modules
  require('load-grunt-tasks')(grunt, { pattern: ['grunt-*', 'assemble'] })
  require('time-grunt')(grunt)

  grunt.loadNpmTasks('grunt-ftp-deploy')

  var path = {
    css_src: 'src/stylesheets/',
    dist: 'dist/',
    dist_test: 'dist_test/',
    dist_html_glob: 'dist/templates/*.html',
    dist_text_glob: 'dist/templates/*.txt',
    dist_test_html_glob: 'dist_test/*.html',
    templates: 'src/templates/',
    layouts: 'src/layouts/',
    partials: 'src/partials/',
    images_src: 'src/images',
  }

  /* Configuration
  ================================================= */

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

    /* secrets.json and config.json simplify variable management to keep the
       common changes centralized to key files instead of being littered
       throughout the Gruntfile. This also makes it easy to .gitignore secrets
    ================================================= */
    secret: grunt.file.exists('secrets.json')
      ? grunt.file.readJSON('secrets.json')
      : {},
    config: grunt.file.readJSON('config.json'),

    /* SASS
    ------------------------------------------------- */

    sass: {
      styles: {
        expand: true,
        cwd: path.css_src,
        ext: '.css',
        src: ['*.scss'],
        dest: `${path.dist}styles/`,
      },
    },

    /* Autoprefixer
    ------------------------------------------------- */

    autoprefixer: {
      options: {
        browsers: ['last 6 versions', 'ie >= 9'],
      },
      styles: {
        expand: true,
        cwd: `${path.dist}styles/`,
        ext: '.css',
        src: ['*.css'],
        dest: `${path.dist}styles/`,
      },
    },

    /* Assemble
       Assembles our handlebars templates. Documentation might be incompatible since the latest version uses an entirely different build system.
       See: https://github.com/assemble/assemble/
    ------------------------------------------------- */

    assemble: {
      options: {
        layoutdir: path.layouts,
        partials: `${path.partials}*.hbs`,
        flatten: true,
        sender_name: '<%= config.strings.sender_name %>',
        product_name: '<%= config.strings.product_name %>',
        product_url: '<%= config.strings.product_url %>',
        credit_card_statement_name:
          '<%= config.strings.credit_card_statement_name %>',
        formal_company_name: '<%= config.strings.formal_company_name %>',
        address_line_1: '<%= config.strings.address_line_1 %>',
        address_line_2: '<%= config.strings.address_line_2 %>',
        city: '<%= config.strings.city %>',
        state: '<%= config.strings.state %>',
        country: '<%= config.strings.country %>',
        phone: '<%= config.strings.phone %>',
        images_url: '<%= config.images.images_url %>',
        use_images: '<%= config.images.use_images %>',
        logo_file: '<%= config.images.logo_file %>',
        logo_width: '<%= config.images.logo_width %>',
        use_social_circles: '<%= config.images.use_social_circles %>',
        twitter_url: '<%= config.images.twitter_url %>',
        facebook_url: '<%= config.images.facebook_url %>',
        pinterest_url: '<%= config.images.pinterest_url %>',
        instagram_url: '<%= config.images.instagram_url %>',
        dribbble_url: '<%= config.images.dribbble_url %>',
        google_plus_url: '<%= config.images.google_plus_url %>',
        youtube_url: '<%= config.images.youtube_url %>',
        linkedin_url: '<%= config.images.linkedin_url %>',
      },
      all: {
        expand: true,
        cwd: 'src/',
        ext: '.hbs',
        src: ['templates/*.hbs', 'layouts/*.hbs'],
        dest: path.dist,
      },
    },

    /* Inline
       Brings external resources in the HTML files. Basically just takes our CSS file and inserts it as a style block.
       See: https://github.com/chyingp/grunt-inline
    ------------------------------------------------- */

    inline: {
      html: {
        expand: true,
        cwd: path.dist,
        ext: '.html',
        src: ['**/*.html'],
        dest: path.dist,
      },
    },

    /* Prettify
       Formats our template HTML files.
       See: https://github.com/jonschlinkert/grunt-prettify
    ------------------------------------------------- */

    prettify: {
      options: {
        indent: '2',
      },
      html: {
        expand: true,
        cwd: path.dist,
        ext: '.html',
        src: ['**/*.html'],
        dest: path.dist,
      },
    },

    /* Premailer
       Adds all sorts of email magic. Adds inline styles to each element based off class. Also generates plain text versions and allows us to control commonly used table attributes via CSS.
       See: https://github.com/dwightjack/grunt-premailer
    ------------------------------------------------- */

    premailer: {
      options: {
        warnLevel: 'none',
      },
      html: {
        options: {
          removeComments: true,
        },
        files: [
          {
            expand: true,
            src: [path.dist_test_html_glob],
            dest: '',
          },
        ],
      },
      txt: {
        options: {
          mode: 'txt',
          lineLength: 16384,
        },
        files: [
          {
            expand: true,
            src: [path.dist_html_glob],
            dest: '',
            ext: '.txt',
          },
        ],
      },
    },

    'ftp-deploy': {
      build: {
        auth: {
          host: '<%= config.ftp.host %>',
          port: '<%= config.ftp.port %>',
          username: '<%= secret.ftp.username %>',
          password: '<%= secret.ftp.password %>',
        },
        src: '<%= config.ftp.src %>',
        dest: '<%= config.ftp.dest %>',
        exclusions: [
          'path/to/source/folder/**/.DS_Store',
          'path/to/source/folder/**/Thumbs.db',
        ],
      },
    },

    /* S3
       Pushes image assets to an Amazon S3 bucket.
       See: https://github.com/jpillora/grunt-aws
    ------------------------------------------------- */

    s3: {
      options: {
        accessKeyId: '<%= secret.s3.access_key_id %>',
        secretAccessKey: '<%= secret.s3.secret_access_key %>',
        bucket: '<%= config.s3.bucket %>',
        region: '<%= config.s3.region %>',
        overwrite: '<%= config.s3.overwrite %>',
      },
      build: {
        cwd: path.images_src,
        src: '**',
      },
    },

    /* Watch
       Watches all files in the src directory for changes.
    ------------------------------------------------- */

    watch: {
      options: {
        livereload: true,
      },
      files: ['src/**/*'],
      tasks: ['default'],
    },

    /* Replace
    ------------------------------------------------- */

    replace: {
      // Premailer escapes URLs, so our mustachio variables for URLs get fully escaped, and the
      // URL variables need to be converted from %7B%7Bsomething%7D%7D to {{something}}
      variableSyntax: {
        src: [path.dist_text_glob],
        overwrite: true,
        replacements: [
          { from: '%7B%7B', to: '{{ ' },
          { from: '%7D%7D', to: ' }}' },
          { from: '%7D%7D%22', to: ' }}' },
          { from: '%20}}', to: ' }}' },
          { from: '{{%20', to: '{{ ' },
        ],
      },
      // Add some additional attributes that grunt inline removed
      styleBlock: {
        src: [path.dist_html_glob],
        overwrite: true,
        replacements: [
          {
            from: '<style>',
            to: '<style type="text/css" rel="stylesheet" media="all">',
          },
        ],
      },
    },

    /* Copy
       This is mainly used to copy compiled templates to a new directory for the CSS to be inlined before being tested.
       See: https://github.com/gruntjs/grunt-contrib-copy
     ------------------------------------------------- */

    copy: {
      testTemplates: {
        files: [
          {
            expand: true,
            src: [path.dist_html_glob],
            dest: path.dist_test,
            flatten: true,
          },
        ],
      },
    },

    /* Spamcheck
       Sends all of our HTML files through Postmark’s spamcheck API.
       See: https://github.com/wildbit/grunt-spamcheck
    ------------------------------------------------- */

    spamcheck: {
      emails: {
        src: [path.dist_html_glob],
      },
    },

    /* Postmark
       Sends test emails through Postmark. Add and remove template targets as needed.
       Ensure that the CSS is always inlined before sending tests. This can be done with the 'testBuild' task below.
       See: https://github.com/wildbit/grunt-postmark
    ------------------------------------------------- */

    postmark: {
      options: {
        serverToken: '<%= secret.postmark.server_token %>',
        from: '<%= config.postmark.from %>',
        to: '<%= config.postmark.to %>',
        subject: '<%= config.postmark.subject %>',
      },
      // run "grunt postmark:welcome" - Sends just the welcome email
      welcome: {
        src: 'dist_test/welcome.html',
      },
      // run "npm run flood" - Sends all of the emails. Be careful not to spam PM if you have a bunch of emails.
      flood: {
        src: [path.dist_test_html_glob],
      },
      // run "npm run litmus" - Add a litmus test address here.
      litmus: {
        to: '<%= config.strings.litmus_email %>',
        src: 'dist_test/user_invitation.html',
      },
    },
  })

  /* Tasks
  ================================================= */

  grunt.registerTask('default', ['css', 'html'])

  // Assets
  grunt.registerTask('html', [
    'assemble',
    'inline',
    'premailer:txt',
    'replace',
    'prettify',
  ])
  grunt.registerTask('css', ['sass', 'autoprefixer'])
  grunt.registerTask('images-ftp', ['ftp-deploy'])
  grunt.registerTask('images-s3', ['s3'])

  // Testing
  grunt.registerTask('spam', ['spamcheck'])
  grunt.registerTask('litmus', ['testBuild', 'postmark:litmus'])
  grunt.registerTask('flood', ['testBuild', 'postmark:flood'])

  // Before sending tests via Postmark, ensure that test builds with inlined CSS are generated
  grunt.registerTask('testBuild', [
    'default',
    'copy:testTemplates',
    'premailer:html',
  ])
}
<commit_msg>Remove prettifier options<commit_after>module.exports = function(grunt) {
  // Include modules
  require('load-grunt-tasks')(grunt, { pattern: ['grunt-*', 'assemble'] })
  require('time-grunt')(grunt)

  grunt.loadNpmTasks('grunt-ftp-deploy')

  var path = {
    css_src: 'src/stylesheets/',
    dist: 'dist/',
    dist_test: 'dist_test/',
    dist_html_glob: 'dist/templates/*.html',
    dist_text_glob: 'dist/templates/*.txt',
    dist_test_html_glob: 'dist_test/*.html',
    templates: 'src/templates/',
    layouts: 'src/layouts/',
    partials: 'src/partials/',
    images_src: 'src/images',
  }

  /* Configuration
  ================================================= */

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

    /* secrets.json and config.json simplify variable management to keep the
       common changes centralized to key files instead of being littered
       throughout the Gruntfile. This also makes it easy to .gitignore secrets
    ================================================= */
    secret: grunt.file.exists('secrets.json')
      ? grunt.file.readJSON('secrets.json')
      : {},
    config: grunt.file.readJSON('config.json'),

    /* SASS
    ------------------------------------------------- */

    sass: {
      styles: {
        expand: true,
        cwd: path.css_src,
        ext: '.css',
        src: ['*.scss'],
        dest: `${path.dist}styles/`,
      },
    },

    /* Autoprefixer
    ------------------------------------------------- */

    autoprefixer: {
      options: {
        browsers: ['last 6 versions', 'ie >= 9'],
      },
      styles: {
        expand: true,
        cwd: `${path.dist}styles/`,
        ext: '.css',
        src: ['*.css'],
        dest: `${path.dist}styles/`,
      },
    },

    /* Assemble
       Assembles our handlebars templates. Documentation might be incompatible since the latest version uses an entirely different build system.
       See: https://github.com/assemble/assemble/
    ------------------------------------------------- */

    assemble: {
      options: {
        layoutdir: path.layouts,
        partials: `${path.partials}*.hbs`,
        flatten: true,
        sender_name: '<%= config.strings.sender_name %>',
        product_name: '<%= config.strings.product_name %>',
        product_url: '<%= config.strings.product_url %>',
        credit_card_statement_name:
          '<%= config.strings.credit_card_statement_name %>',
        formal_company_name: '<%= config.strings.formal_company_name %>',
        address_line_1: '<%= config.strings.address_line_1 %>',
        address_line_2: '<%= config.strings.address_line_2 %>',
        city: '<%= config.strings.city %>',
        state: '<%= config.strings.state %>',
        country: '<%= config.strings.country %>',
        phone: '<%= config.strings.phone %>',
        images_url: '<%= config.images.images_url %>',
        use_images: '<%= config.images.use_images %>',
        logo_file: '<%= config.images.logo_file %>',
        logo_width: '<%= config.images.logo_width %>',
        use_social_circles: '<%= config.images.use_social_circles %>',
        twitter_url: '<%= config.images.twitter_url %>',
        facebook_url: '<%= config.images.facebook_url %>',
        pinterest_url: '<%= config.images.pinterest_url %>',
        instagram_url: '<%= config.images.instagram_url %>',
        dribbble_url: '<%= config.images.dribbble_url %>',
        google_plus_url: '<%= config.images.google_plus_url %>',
        youtube_url: '<%= config.images.youtube_url %>',
        linkedin_url: '<%= config.images.linkedin_url %>',
      },
      all: {
        expand: true,
        cwd: 'src/',
        ext: '.hbs',
        src: ['templates/*.hbs', 'layouts/*.hbs'],
        dest: path.dist,
      },
    },

    /* Inline
       Brings external resources in the HTML files. Basically just takes our CSS file and inserts it as a style block.
       See: https://github.com/chyingp/grunt-inline
    ------------------------------------------------- */

    inline: {
      html: {
        expand: true,
        cwd: path.dist,
        ext: '.html',
        src: ['**/*.html'],
        dest: path.dist,
      },
    },

    /* Prettify
       Formats our template HTML files.
       See: https://github.com/jonschlinkert/grunt-prettify
    ------------------------------------------------- */

    prettify: {
      html: {
        expand: true,
        cwd: path.dist,
        ext: '.html',
        src: ['**/*.html'],
        dest: path.dist,
      },
    },

    /* Premailer
       Adds all sorts of email magic. Adds inline styles to each element based off class. Also generates plain text versions and allows us to control commonly used table attributes via CSS.
       See: https://github.com/dwightjack/grunt-premailer
    ------------------------------------------------- */

    premailer: {
      options: {
        warnLevel: 'none',
      },
      html: {
        options: {
          removeComments: true,
        },
        files: [
          {
            expand: true,
            src: [path.dist_test_html_glob],
            dest: '',
          },
        ],
      },
      txt: {
        options: {
          mode: 'txt',
          lineLength: 16384,
        },
        files: [
          {
            expand: true,
            src: [path.dist_html_glob],
            dest: '',
            ext: '.txt',
          },
        ],
      },
    },

    'ftp-deploy': {
      build: {
        auth: {
          host: '<%= config.ftp.host %>',
          port: '<%= config.ftp.port %>',
          username: '<%= secret.ftp.username %>',
          password: '<%= secret.ftp.password %>',
        },
        src: '<%= config.ftp.src %>',
        dest: '<%= config.ftp.dest %>',
        exclusions: [
          'path/to/source/folder/**/.DS_Store',
          'path/to/source/folder/**/Thumbs.db',
        ],
      },
    },

    /* S3
       Pushes image assets to an Amazon S3 bucket.
       See: https://github.com/jpillora/grunt-aws
    ------------------------------------------------- */

    s3: {
      options: {
        accessKeyId: '<%= secret.s3.access_key_id %>',
        secretAccessKey: '<%= secret.s3.secret_access_key %>',
        bucket: '<%= config.s3.bucket %>',
        region: '<%= config.s3.region %>',
        overwrite: '<%= config.s3.overwrite %>',
      },
      build: {
        cwd: path.images_src,
        src: '**',
      },
    },

    /* Watch
       Watches all files in the src directory for changes.
    ------------------------------------------------- */

    watch: {
      options: {
        livereload: true,
      },
      files: ['src/**/*'],
      tasks: ['default'],
    },

    /* Replace
    ------------------------------------------------- */

    replace: {
      // Premailer escapes URLs, so our mustachio variables for URLs get fully escaped, and the
      // URL variables need to be converted from %7B%7Bsomething%7D%7D to {{something}}
      variableSyntax: {
        src: [path.dist_text_glob],
        overwrite: true,
        replacements: [
          { from: '%7B%7B', to: '{{ ' },
          { from: '%7D%7D', to: ' }}' },
          { from: '%7D%7D%22', to: ' }}' },
          { from: '%20}}', to: ' }}' },
          { from: '{{%20', to: '{{ ' },
        ],
      },
      // Add some additional attributes that grunt inline removed
      styleBlock: {
        src: [path.dist_html_glob],
        overwrite: true,
        replacements: [
          {
            from: '<style>',
            to: '<style type="text/css" rel="stylesheet" media="all">',
          },
        ],
      },
    },

    /* Copy
       This is mainly used to copy compiled templates to a new directory for the CSS to be inlined before being tested.
       See: https://github.com/gruntjs/grunt-contrib-copy
     ------------------------------------------------- */

    copy: {
      testTemplates: {
        files: [
          {
            expand: true,
            src: [path.dist_html_glob],
            dest: path.dist_test,
            flatten: true,
          },
        ],
      },
    },

    /* Spamcheck
       Sends all of our HTML files through Postmark’s spamcheck API.
       See: https://github.com/wildbit/grunt-spamcheck
    ------------------------------------------------- */

    spamcheck: {
      emails: {
        src: [path.dist_html_glob],
      },
    },

    /* Postmark
       Sends test emails through Postmark. Add and remove template targets as needed.
       Ensure that the CSS is always inlined before sending tests. This can be done with the 'testBuild' task below.
       See: https://github.com/wildbit/grunt-postmark
    ------------------------------------------------- */

    postmark: {
      options: {
        serverToken: '<%= secret.postmark.server_token %>',
        from: '<%= config.postmark.from %>',
        to: '<%= config.postmark.to %>',
        subject: '<%= config.postmark.subject %>',
      },
      // run "grunt postmark:welcome" - Sends just the welcome email
      welcome: {
        src: 'dist_test/welcome.html',
      },
      // run "npm run flood" - Sends all of the emails. Be careful not to spam PM if you have a bunch of emails.
      flood: {
        src: [path.dist_test_html_glob],
      },
      // run "npm run litmus" - Add a litmus test address here.
      litmus: {
        to: '<%= config.strings.litmus_email %>',
        src: 'dist_test/user_invitation.html',
      },
    },
  })

  /* Tasks
  ================================================= */

  grunt.registerTask('default', ['css', 'html'])

  // Assets
  grunt.registerTask('html', [
    'assemble',
    'inline',
    'premailer:txt',
    'replace',
    'prettify',
  ])
  grunt.registerTask('css', ['sass', 'autoprefixer'])
  grunt.registerTask('images-ftp', ['ftp-deploy'])
  grunt.registerTask('images-s3', ['s3'])

  // Testing
  grunt.registerTask('spam', ['spamcheck'])
  grunt.registerTask('litmus', ['testBuild', 'postmark:litmus'])
  grunt.registerTask('flood', ['testBuild', 'postmark:flood'])

  // Before sending tests via Postmark, ensure that test builds with inlined CSS are generated
  grunt.registerTask('testBuild', [
    'default',
    'copy:testTemplates',
    'premailer:html',
  ])
}
<|endoftext|>


<commit_before>// Generated on 2014-04-18 using generator-angular 0.8.0
'use strict';

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

module.exports = function (grunt) {

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

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

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

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

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      // bower: {
      //   files: ['bower.json'],
      //   tasks: ['bowerInstall']
      // },
      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']
      },
      ngtemplates: {
        files: '<%= yeoman.app %>/views/*.html',
        tasks: ['ngtemplates']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: 'http://localhost:9000',
          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
    ngtemplates: {
      options: {
        base: '<%= yeoman.app %>',
        module: 'depthyApp',
        // prefix: '/',
        htmlmin: {
          collapseBooleanAttributes:      true,
          collapseWhitespace:             true,
          removeAttributeQuotes:          true,
          removeComments:                 true, // Only if you don't use comment directives!
          removeEmptyAttributes:          true,
          removeRedundantAttributes:      true,
          removeScriptTypeAttributes:     true,
          removeStyleLinkTypeAttributes:  true
        }
      },
      html: {
        cwd: '<%= yeoman.app %>',
        src: [
          'views/**/*.html',
          'bower_components/angular-ui-bootstrap/template/modal/*.html',
        ],
        dest: '.tmp/scripts/templates.js'
      },
      uibstemplates: {
        cwd: '<%= yeoman.app %>/bower_components/angular-ui-bootstrap',
        src: [
          'template/modal/*.html',
        ],
        dest: '.tmp/scripts/bs-templates.js'
      },

    },
    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
    bowerInstall: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: '<%= yeoman.app %>/'
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

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

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          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 rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    cssmin: {
      options: {
        root: '<%= yeoman.app %>'
      }
    },

    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', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: 'scripts.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,gif,jpg,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'samples/*',
            'styles/fonts/*',
            'CNAME',
            'bower_components/gif.js/dist/*.js'
          ]
        }, {
          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',
        'ngtemplates'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'ngtemplates',
        'imagemin',
        'svgmin'
      ]
    },

    // 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',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    uglify: {
      options: {
        // compress: false,
        // preserveComments: 'all',
        // beautify: true,
      }
    },
    // concat: {
    //   dist: {}
    // },

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

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

    grunt.task.run([
      'clean:server',
      // 'bowerInstall',
      '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',
    // 'bowerInstall',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>gruntfix<commit_after>// Generated on 2014-04-18 using generator-angular 0.8.0
'use strict';

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

module.exports = function (grunt) {

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

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

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

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

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      // bower: {
      //   files: ['bower.json'],
      //   tasks: ['bowerInstall']
      // },
      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']
      },
      ngtemplates: {
        files: '<%= yeoman.app %>/views/*.html',
        tasks: ['ngtemplates']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: 'http://localhost:9000',
          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
    ngtemplates: {
      options: {
        base: '<%= yeoman.app %>',
        module: 'depthyApp',
        // prefix: '/',
        htmlmin: {
          collapseBooleanAttributes:      true,
          collapseWhitespace:             true,
          removeAttributeQuotes:          true,
          removeComments:                 true, // Only if you don't use comment directives!
          removeEmptyAttributes:          true,
          removeRedundantAttributes:      true,
          removeScriptTypeAttributes:     true,
          removeStyleLinkTypeAttributes:  true
        }
      },
      html: {
        cwd: '<%= yeoman.app %>',
        src: [
          'views/**/*.html',
          'bower_components/angular-ui-bootstrap/template/modal/*.html',
        ],
        dest: '.tmp/scripts/templates.js'
      },
      uibstemplates: {
        cwd: '<%= yeoman.app %>/bower_components/angular-ui-bootstrap',
        src: [
          'template/modal/*.html',
        ],
        dest: '.tmp/scripts/bs-templates.js'
      },

    },
    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
    bowerInstall: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: '<%= yeoman.app %>/'
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= yeoman.app %>/bower_components/'
      }
    },

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

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          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 rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/styles']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    // cssmin: {
    //   options: {
    //     root: '<%= yeoman.app %>'
    //   }
    // },

    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', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: 'scripts.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,gif,jpg,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'samples/*',
            'styles/fonts/*',
            'CNAME',
            'bower_components/gif.js/dist/*.js'
          ]
        }, {
          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',
        'ngtemplates'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'ngtemplates',
        'imagemin',
        'svgmin'
      ]
    },

    uglify: {
      options: {
        // compress: false,
        // preserveComments: 'all',
        // beautify: true,
      }
    },
    // concat: {
    //   dist: {}
    // },

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

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

    grunt.task.run([
      'clean:server',
      // 'bowerInstall',
      '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',
    // 'bowerInstall',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

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


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

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        // secrets.json is ignored in git because it contains sensitive data
        // See the README for configuration settings
        secrets: grunt.file.readJSON('secrets.json'),

        // Re-usable filesystem paths (these shouldn't be modified)
        paths: {
          src:        'src',
          src_img:    'src/img',
          dist:       'dist',
          dist_img:   'dist/img'
        },

        // Takes your scss files and compiles them to css
        sass: {
          dist: {
            options: {
              style: 'expanded'
            },
            files: {
              '<%= paths.src %>/css/main.css': '<%= paths.src %>/css/scss/main.scss'
            }
          }
        },

        // Assembles your email content with html layout
        assemble: {
          options: {
            layoutdir: '<%= paths.src %>/layouts',
            partials: ['<%= paths.src %>/partials/**/*.hbs'],
            data: ['<%= paths.src %>/data/*.{json,yml}'],
            flatten: true
          },
          pages: {
            src: ['<%= paths.src %>/emails/*.hbs'],
            dest: '<%= paths.dist %>/'
          }
        },

        // Replace compiled template images sources from ../src/html to ../dist/html
        replace: {
          src_images: {
            options: {
              usePrefix: false,
              patterns: [
                {
                  match: /(<img[^>]+[\"'])(\.\.\/src\/img\/)/gi,  // Matches <img * src="../src/img or <img * src='../src/img'
                  replacement: '$1../<%= paths.dist_img %>/'
                },
                {
                  match: /(url\(*[^)])(\.\.\/src\/img\/)/gi,  // Matches url('../src/img') or url(../src/img) and even url("../src/img")
                  replacement: '$1../<%= paths.dist_img %>/'
                }
              ]
            },
            files: [{
              expand: true,
              flatten: true,
              src: ['<%= paths.dist %>/*.html'],
              dest: '<%= paths.dist %>'
            }]
          }
        },

        // Inlines your css
        premailer: {
          html: {
            options: {
              removeComments: true
            },
            files: [{
                expand: true,
                src: ['<%= paths.dist %>/*.html'],
                dest: ''
            }]
          },
          txt: {
            options: {
              mode: 'txt'
            },
            files: [{
                expand: true,
                src: ['<%= paths.dist %>/*.html'],
                dest: '',
                ext: '.txt'
            }]
          }
        },

        // Optimize images
        imagemin: {
          dynamic: {
            options: {
              optimizationLevel: 3,
              svgoPlugins: [{ removeViewBox: false }]
            },
            files: [{
              expand: true,
              cwd: '<%= paths.src_img %>',
              src: ['**/*.{png,jpg,gif}'],
              dest: '<%= paths.dist_img %>'
            }]
          }
        },

        // Watches for changes to css or email templates then runs grunt tasks
        watch: {
          files: ['<%= paths.src %>/css/scss/*','<%= paths.src %>/emails/*','<%= paths.src %>/layouts/*','<%= paths.src %>/partials/*','<%= paths.src %>/data/*'],
          tasks: ['default']
        },

        // Use Mailgun option if you want to email the design to your inbox or to something like Litmus
        // grunt send --template=transaction.html
        mailgun: {
          mailer: {
            options: {
              key: '<%= secrets.mailgun.api_key %>', // See README for secrets.json or replace this with your own key
              sender: '<%= secrets.mailgun.sender %>', // See README for secrets.json or replace this with your preferred sender
              recipient: '<%= secrets.mailgun.recipient %>', // See README for secrets.json or replace this with your preferred recipient
              subject: 'This is a test email'
            },
            src: ['<%= paths.dist %>/'+grunt.option('template')]
          }
        },

        // Use Rackspace Cloud Files if you're using images in your email
        cloudfiles: {
          prod: {
            'user': '<%= secrets.cloudfiles.user %>', // See README for secrets.json or replace this with your user
            'key': '<%= secrets.cloudfiles.key %>', // See README for secrets.json or replace this with your own key
            'region': '<%= secrets.cloudfiles.region %>', // See README for secrets.json or replace this with your region
            'upload': [{
              'container': '<%= secrets.cloudfiles.container %>', // See README for secrets.json or replace this with your container name
              'src': '<%= paths.src_img %>/*',
              'dest': '/',
              'stripcomponents': 0
            }]
          }
        },

        // CDN will replace local paths with your CDN path
        cdn: {
          cloudfiles: {
            options: {
              cdn: '<%= secrets.cloudfiles.uri %>', // See README for secrets.json or replace this with your cdn uri
              flatten: true,
              supportedTypes: 'html'
            },
            cwd: './dist/',
            dest: './dist/',
            src: ['*.html']
          },
          aws_s3: {
            options: {
              cdn: '<%= secrets.s3.bucketpath %>', // See README for secrets.json or replace this with your Amazon S3 bucket uri
              flatten: true,
              supportedTypes: 'html'
            },
            cwd: './dist/',
            dest: './dist/',
            src: ['*.html']
          }
        },

        // Use Amazon S3 for images
        aws_s3: {
          options: {
            accessKeyId: '<%= secrets.s3.key %>', // See README for secrets.json
            secretAccessKey: '<%= secrets.s3.secret %>', // See README for secrets.json
            region: '', // Enter region or leave blank for US Standard region
            uploadConcurrency: 5, // 5 simultaneous uploads
            downloadConcurrency: 5 // 5 simultaneous downloads
          },
          prod: {
            options: {
              bucket: '<%= secrets.s3.bucketname %>', // Define your S3 bucket name in secrets.json
              differential: true, // Only uploads the files that have changed
              params: {
                CacheControl: '2000'
              }
            },
            files: [
              {expand: true, cwd: 'dist/img/', src: ['**'], dest: '/src/img'}
            ]
          }
        },

        // Send your email template to Litmus for testing
        // grunt litmus --template=transaction.html
        litmus: {
          test: {
            src: ['<%= paths.dist %>/'+grunt.option('template')],
            options: {
              username: '<%= secrets.litmus.username %>', // See README for secrets.json or replace this with your username
              password: '<%= secrets.litmus.password %>', // See README for secrets.json or replace this with your password
              url: 'https://<%= secrets.litmus.company %>.litmus.com', // See README for secrets.json or replace this with your company url
              clients: ['android4', 'aolonline', 'androidgmailapp', 'aolonline', 'ffaolonline',
              'chromeaolonline', 'appmail6', 'iphone6', 'ipadmini', 'ipad', 'chromegmailnew',
              'iphone6plus', 'notes85', 'ol2002', 'ol2003', 'ol2007', 'ol2010', 'ol2011',
              'ol2013', 'outlookcom', 'chromeoutlookcom', 'chromeyahoo', 'windowsphone8'] // https://#{company}.litmus.com/emails/clients.xml
            }
          }
        }

    });

    // Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('assemble');
    grunt.loadNpmTasks('grunt-mailgun');
    grunt.loadNpmTasks('grunt-premailer');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-cloudfiles');
    grunt.loadNpmTasks('grunt-cdn');
    grunt.loadNpmTasks('grunt-aws-s3');
    grunt.loadNpmTasks('grunt-litmus');
    grunt.loadNpmTasks('grunt-contrib-imagemin');
    grunt.loadNpmTasks('grunt-replace');

    // Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('default', ['sass','assemble','premailer','imagemin','replace:src_images']);

    // Use grunt send if you want to actually send the email to your inbox
    grunt.registerTask('send', ['mailgun']);

    // Upload images to our CDN on Rackspace Cloud Files
    grunt.registerTask('cdnify', ['default','cloudfiles','cdn:cloudfiles']);

    // Upload image files to Amazon S3
    grunt.registerTask('s3upload', ['aws_s3:prod', 'cdn:aws_s3']);

};
<commit_msg>update aws path<commit_after>module.exports = function(grunt) {

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        // secrets.json is ignored in git because it contains sensitive data
        // See the README for configuration settings
        secrets: grunt.file.readJSON('secrets.json'),

        // Re-usable filesystem paths (these shouldn't be modified)
        paths: {
          src:        'src',
          src_img:    'src/img',
          dist:       'dist',
          dist_img:   'dist/img'
        },

        // Takes your scss files and compiles them to css
        sass: {
          dist: {
            options: {
              style: 'expanded'
            },
            files: {
              '<%= paths.src %>/css/main.css': '<%= paths.src %>/css/scss/main.scss'
            }
          }
        },

        // Assembles your email content with html layout
        assemble: {
          options: {
            layoutdir: '<%= paths.src %>/layouts',
            partials: ['<%= paths.src %>/partials/**/*.hbs'],
            data: ['<%= paths.src %>/data/*.{json,yml}'],
            flatten: true
          },
          pages: {
            src: ['<%= paths.src %>/emails/*.hbs'],
            dest: '<%= paths.dist %>/'
          }
        },

        // Replace compiled template images sources from ../src/html to ../dist/html
        replace: {
          src_images: {
            options: {
              usePrefix: false,
              patterns: [
                {
                  match: /(<img[^>]+[\"'])(\.\.\/src\/img\/)/gi,  // Matches <img * src="../src/img or <img * src='../src/img'
                  replacement: '$1../<%= paths.dist_img %>/'
                },
                {
                  match: /(url\(*[^)])(\.\.\/src\/img\/)/gi,  // Matches url('../src/img') or url(../src/img) and even url("../src/img")
                  replacement: '$1../<%= paths.dist_img %>/'
                }
              ]
            },
            files: [{
              expand: true,
              flatten: true,
              src: ['<%= paths.dist %>/*.html'],
              dest: '<%= paths.dist %>'
            }]
          }
        },

        // Inlines your css
        premailer: {
          html: {
            options: {
              removeComments: true
            },
            files: [{
                expand: true,
                src: ['<%= paths.dist %>/*.html'],
                dest: ''
            }]
          },
          txt: {
            options: {
              mode: 'txt'
            },
            files: [{
                expand: true,
                src: ['<%= paths.dist %>/*.html'],
                dest: '',
                ext: '.txt'
            }]
          }
        },

        // Optimize images
        imagemin: {
          dynamic: {
            options: {
              optimizationLevel: 3,
              svgoPlugins: [{ removeViewBox: false }]
            },
            files: [{
              expand: true,
              cwd: '<%= paths.src_img %>',
              src: ['**/*.{png,jpg,gif}'],
              dest: '<%= paths.dist_img %>'
            }]
          }
        },

        // Watches for changes to css or email templates then runs grunt tasks
        watch: {
          files: ['<%= paths.src %>/css/scss/*','<%= paths.src %>/emails/*','<%= paths.src %>/layouts/*','<%= paths.src %>/partials/*','<%= paths.src %>/data/*'],
          tasks: ['default']
        },

        // Use Mailgun option if you want to email the design to your inbox or to something like Litmus
        // grunt send --template=transaction.html
        mailgun: {
          mailer: {
            options: {
              key: '<%= secrets.mailgun.api_key %>', // See README for secrets.json or replace this with your own key
              sender: '<%= secrets.mailgun.sender %>', // See README for secrets.json or replace this with your preferred sender
              recipient: '<%= secrets.mailgun.recipient %>', // See README for secrets.json or replace this with your preferred recipient
              subject: 'This is a test email'
            },
            src: ['<%= paths.dist %>/'+grunt.option('template')]
          }
        },

        // Use Rackspace Cloud Files if you're using images in your email
        cloudfiles: {
          prod: {
            'user': '<%= secrets.cloudfiles.user %>', // See README for secrets.json or replace this with your user
            'key': '<%= secrets.cloudfiles.key %>', // See README for secrets.json or replace this with your own key
            'region': '<%= secrets.cloudfiles.region %>', // See README for secrets.json or replace this with your region
            'upload': [{
              'container': '<%= secrets.cloudfiles.container %>', // See README for secrets.json or replace this with your container name
              'src': '<%= paths.src_img %>/*',
              'dest': '/',
              'stripcomponents': 0
            }]
          }
        },

        // CDN will replace local paths with your CDN path
        cdn: {
          cloudfiles: {
            options: {
              cdn: '<%= secrets.cloudfiles.uri %>', // See README for secrets.json or replace this with your cdn uri
              flatten: true,
              supportedTypes: 'html'
            },
            cwd: './dist/',
            dest: './dist/',
            src: ['*.html']
          },
          aws_s3: {
            options: {
              cdn: '<%= secrets.s3.bucketpath %>', // See README for secrets.json or replace this with your Amazon S3 bucket uri
              flatten: true,
              supportedTypes: 'html'
            },
            cwd: './dist/',
            dest: './dist/',
            src: ['*.html']
          }
        },

        // Use Amazon S3 for images
        aws_s3: {
          options: {
            accessKeyId: '<%= secrets.s3.key %>', // See README for secrets.json
            secretAccessKey: '<%= secrets.s3.secret %>', // See README for secrets.json
            region: '', // Enter region or leave blank for US Standard region
            uploadConcurrency: 5, // 5 simultaneous uploads
            downloadConcurrency: 5 // 5 simultaneous downloads
          },
          prod: {
            options: {
              bucket: '<%= secrets.s3.bucketname %>', // Define your S3 bucket name in secrets.json
              differential: true, // Only uploads the files that have changed
              params: {
                CacheControl: '2000'
              }
            },
            files: [
              {expand: true, cwd: '<%= paths.dist_img %>', src: ['**'], dest: 'test/<%= paths.dist_img %>'}
            ]
          }
        },

        // Send your email template to Litmus for testing
        // grunt litmus --template=transaction.html
        litmus: {
          test: {
            src: ['<%= paths.dist %>/'+grunt.option('template')],
            options: {
              username: '<%= secrets.litmus.username %>', // See README for secrets.json or replace this with your username
              password: '<%= secrets.litmus.password %>', // See README for secrets.json or replace this with your password
              url: 'https://<%= secrets.litmus.company %>.litmus.com', // See README for secrets.json or replace this with your company url
              clients: ['android4', 'aolonline', 'androidgmailapp', 'aolonline', 'ffaolonline',
              'chromeaolonline', 'appmail6', 'iphone6', 'ipadmini', 'ipad', 'chromegmailnew',
              'iphone6plus', 'notes85', 'ol2002', 'ol2003', 'ol2007', 'ol2010', 'ol2011',
              'ol2013', 'outlookcom', 'chromeoutlookcom', 'chromeyahoo', 'windowsphone8'] // https://#{company}.litmus.com/emails/clients.xml
            }
          }
        }

    });

    // Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('assemble');
    grunt.loadNpmTasks('grunt-mailgun');
    grunt.loadNpmTasks('grunt-premailer');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-cloudfiles');
    grunt.loadNpmTasks('grunt-cdn');
    grunt.loadNpmTasks('grunt-aws-s3');
    grunt.loadNpmTasks('grunt-litmus');
    grunt.loadNpmTasks('grunt-contrib-imagemin');
    grunt.loadNpmTasks('grunt-replace');

    // Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('default', ['sass','assemble','premailer','imagemin','replace:src_images']);

    // Use grunt send if you want to actually send the email to your inbox
    grunt.registerTask('send', ['mailgun']);

    // Upload images to our CDN on Rackspace Cloud Files
    grunt.registerTask('cdnify', ['default','cloudfiles','cdn:cloudfiles']);

    // Upload image files to Amazon S3
    grunt.registerTask('s3upload', ['aws_s3:prod', 'cdn:aws_s3']);

};
<|endoftext|>