<commit_before>// @remove-file-on-eject
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
'use strict';

const fs = require('fs');
const chalk = require('chalk');
const paths = require('../../config/paths');

module.exports = (resolve, rootDir) => {
  // Use this instead of `paths.testsSetup` to avoid putting
  // an absolute filename into configuration after ejecting.
  const setupTestsFile = fs.existsSync(paths.testsSetup)
    ? '<rootDir>/src/setupTests.ts'
    : undefined;

  // TODO: I don't know if it's safe or not to just use / as path separator
  // in Jest configs. We need help from somebody with Windows to determine this.
  const config = {
    collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
    setupFiles: [resolve('config/polyfills.js')],
    setupTestFrameworkScriptFile: setupTestsFile,
    moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
    testMatch: [
      '<rootDir>/src/**/__tests__/**/*.ts?(x)',
      '<rootDir>/src/**/?(*.)(spec|test).ts?(x)',
    ],
    testEnvironment: 'node',
    testURL: 'http://localhost',
    transform: {
      '^.+\\.css$': resolve('config/jest/cssTransform.js'),
      '^.+\\.tsx?$': resolve('config/jest/typescriptTransform.js'),
      '^(?!.*\\.(css|json)$)': resolve('config/jest/fileTransform.js'),
    },
    transformIgnorePatterns: [
      '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tssx)$',
    ],
    moduleNameMapper: {
      '^react-native$': 'react-native-web',
    },
  };
  if (rootDir) {
    config.rootDir = rootDir;
  }
  const overrides = Object.assign({}, require(paths.appPackageJson).jest);
  const supportedKeys = [
    'collectCoverageFrom',
    'coverageReporters',
    'coverageThreshold',
    'snapshotSerializers',
  ];
  if (overrides) {
    supportedKeys.forEach(key => {
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      console.error(
        chalk.red(
          'Out of the box, Create React App only supports overriding ' +
            'these Jest options:\n\n' +
            supportedKeys.map(key => chalk.bold('  \u2022 ' + key)).join('\n') +
            '.\n\n' +
            'These options in your package.json Jest configuration ' +
            'are not currently supported by Create React App:\n\n' +
            unsupportedKeys
              .map(key => chalk.bold('  \u2022 ' + key))
              .join('\n') +
            '\n\nIf you wish to override other Jest options, you need to ' +
            'eject from the default setup. You can do so by running ' +
            chalk.bold('npm run eject') +
            ' but remember that this is a one-way operation. ' +
            'You may also file an issue with Create React App to discuss ' +
            'supporting more options out of the box.\n'
        )
      );
      process.exit(1);
    }
  }
  return config;
};
<commit_msg>Allow loading modules from json files<commit_after>// @remove-file-on-eject
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
'use strict';

const fs = require('fs');
const chalk = require('chalk');
const paths = require('../../config/paths');

module.exports = (resolve, rootDir) => {
  // Use this instead of `paths.testsSetup` to avoid putting
  // an absolute filename into configuration after ejecting.
  const setupTestsFile = fs.existsSync(paths.testsSetup)
    ? '<rootDir>/src/setupTests.ts'
    : undefined;

  // TODO: I don't know if it's safe or not to just use / as path separator
  // in Jest configs. We need help from somebody with Windows to determine this.
  const config = {
    collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
    setupFiles: [resolve('config/polyfills.js')],
    setupTestFrameworkScriptFile: setupTestsFile,
    moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
    testMatch: [
      '<rootDir>/src/**/__tests__/**/*.ts?(x)',
      '<rootDir>/src/**/?(*.)(spec|test).ts?(x)',
    ],
    testEnvironment: 'node',
    testURL: 'http://localhost',
    transform: {
      '^.+\\.css$': resolve('config/jest/cssTransform.js'),
      '^.+\\.tsx?$': resolve('config/jest/typescriptTransform.js'),
      '^(?!.*\\.(css|json)$)': resolve('config/jest/fileTransform.js'),
    },
    transformIgnorePatterns: [
      '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tssx)$',
    ],
    moduleNameMapper: {
      '^react-native$': 'react-native-web',
    },
  };
  if (rootDir) {
    config.rootDir = rootDir;
  }
  const overrides = Object.assign({}, require(paths.appPackageJson).jest);
  const supportedKeys = [
    'collectCoverageFrom',
    'coverageReporters',
    'coverageThreshold',
    'snapshotSerializers',
  ];
  if (overrides) {
    supportedKeys.forEach(key => {
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      console.error(
        chalk.red(
          'Out of the box, Create React App only supports overriding ' +
            'these Jest options:\n\n' +
            supportedKeys.map(key => chalk.bold('  \u2022 ' + key)).join('\n') +
            '.\n\n' +
            'These options in your package.json Jest configuration ' +
            'are not currently supported by Create React App:\n\n' +
            unsupportedKeys
              .map(key => chalk.bold('  \u2022 ' + key))
              .join('\n') +
            '\n\nIf you wish to override other Jest options, you need to ' +
            'eject from the default setup. You can do so by running ' +
            chalk.bold('npm run eject') +
            ' but remember that this is a one-way operation. ' +
            'You may also file an issue with Create React App to discuss ' +
            'supporting more options out of the box.\n'
        )
      );
      process.exit(1);
    }
  }
  return config;
};
<|endoftext|>


<commit_before>import _ from 'lodash';
const colorMap = {
  feature: '#0277bd',
  service: '#ec407a',
  services: '#ec407a',
  'initial-state': '#ec407a',
  'ui-module': '#f08036',
  'ui-modules': '#f08036',
  'folder-alias': '#8d6e63',
  normal: '#888888',
  routes: '#26a69a',
  page: '#4CAF50',
  layout: '#CDDC39',
  others: '#8d6e63',
};

const iconMap = {
  features: 'rekit',
  feature: 'book',
  service: 'service',
  services: 'service',
  'initial-state': 'database',
  'ui-module': 'appstore-o',
  'ui-modules': 'appstore-o',
  layout: 'ui',
  layouts: 'ui',
  'folder-alias': 'folder',
  folder: 'folder',
  others: 'folder',
  file: 'file',
  routes: 'sharealt',
  page: 'page',
};

let byId;
let rawElements;
let setById;

const getElements = (dir, type) => {
  const children = byId(dir).children.map(c => {
    const ele = byId(c);
    const keyMap = {
      'style.less': 'Style',
      'template.marko': 'Template',
      'index.js': 'Index',
      'browser.json': 'Browser',
    };
    const viewName = id => {
      const name = byId(id).name;
      return keyMap[name] || name;
    };
    const views = ele.children
      .filter(cid => byId(cid).type === 'file')
      .map(cid => ({ key: viewName(cid).toLowerCase(), target: cid, name: viewName(cid) }));
    if (views.length) views[0].isDefault = true;
    const p = {
      id: `v:${ele.id}`,
      name: ele.name,
      type,
      icon: iconMap[type],
      tabIconColor: colorMap[type],
      navigable: true,
      views: [{ key: 'diagram', name: 'Diagram' }, ...views],
      parts: ele.children.filter(cid => byId(cid).type === 'file'),
    };
    setById(p.id, p);
    return p;
  });
  return children.map(c => c.id);
};

const getRoutesNode = () => {
  return {
    id: 'v:routes',
    name: 'Routes',
    type: 'routes',
    icon: iconMap.routes,
    iconColor: colorMap.routes,
    views: [{ key: 'rules', name: 'Rules' }, { key: 'code', name: 'Code', target: 'routes.json' }],
  };
};
const getPagesNode = () => {
  return {
    id: 'v:pages',
    name: 'Pages',
    type: 'pages',
    icon: iconMap.page,
    iconColor: colorMap.page,
    children: getElements('src/pages', 'page'),
  };
};
const getUiModulesNode = () => {
  return {
    id: 'v:ui-modules',
    name: 'UI Modules',
    type: 'ui-modules',
    icon: iconMap['ui-modules'],
    iconColor: colorMap['ui-modules'],
    children: getElements('src/ui-modules', 'ui-module'),
  };
};
const getLayoutsNode = () => {
  return {
    id: 'v:layouts',
    name: 'Layouts',
    type: 'layouts',
    icon: iconMap.layout,
    iconColor: colorMap.layout,
    children: getElements('src/layouts', 'layout'),
  };
};
const getServicesNode = () => {
  return {
    id: 'v:misc',
    type: 'services',
    name: 'Services',
    icon: iconMap.services,
    iconColor: colorMap.services,
    children: getElements('src/services', 'service'),
  };
};

const getOthersNode = () => {
  return {
    id: 'v:others',
    type: 'folder-alias',
    name: 'Others',
    icon: iconMap.others,
    iconColor: colorMap.others,
    children: rawElements,
  };
};

export default {
  processProjectData(prjData) {
    byId = id => prjData.elementById[id];
    setById = (id, ele) => (prjData.elementById[id] = ele);
    // setById('routes.json', {
    //   name: 'routes.json',
    //   id: 'routes.json',
    //   type: 'file',
    // });
    rawElements = prjData.elements.slice();

    const routesNode = getRoutesNode();
    const pagesNode = getPagesNode();
    const uiModulesNode = getUiModulesNode();
    const layoutsNode = getLayoutsNode();
    const servicesNode = getServicesNode();
    const othersNode = getOthersNode();

    routesNode.count = prjData.routes.length;
    pagesNode.count = pagesNode.children.length;
    uiModulesNode.count = uiModulesNode.children.length;
    layoutsNode.count = layoutsNode.children.length;
    servicesNode.count = servicesNode.children.length;

    const rootChildren = [
      routesNode,
      pagesNode,
      uiModulesNode,
      layoutsNode,
      servicesNode,
      othersNode,
    ];
    rootChildren.forEach(c => (prjData.elementById[c.id] = c));
    prjData.elements = rootChildren.map(c => c.id);

    Object.values(prjData.elementById).forEach(ele => {
      switch (ele.type) {
        case 'ui-module':
        case 'service':
        case 'layoutt':
        case 'file':
        case 'routes':
          ele.navigable = true;
          break;
        default:
          break;
      }
    });
  },
};
<commit_msg>Remove elements folder from others.<commit_after>import _ from 'lodash';
const colorMap = {
  feature: '#0277bd',
  service: '#ec407a',
  services: '#ec407a',
  'initial-state': '#ec407a',
  'ui-module': '#f08036',
  'ui-modules': '#f08036',
  'folder-alias': '#8d6e63',
  normal: '#888888',
  routes: '#26a69a',
  page: '#4CAF50',
  layout: '#CDDC39',
  others: '#8d6e63',
};

const iconMap = {
  features: 'rekit',
  feature: 'book',
  service: 'service',
  services: 'service',
  'initial-state': 'database',
  'ui-module': 'appstore-o',
  'ui-modules': 'appstore-o',
  layout: 'ui',
  layouts: 'ui',
  'folder-alias': 'folder',
  folder: 'folder',
  others: 'folder',
  file: 'file',
  routes: 'sharealt',
  page: 'page',
};

let byId;
let rawElements;
let setById;

const getElements = (dir, type) => {
  const children = byId(dir).children.map(c => {
    const ele = byId(c);
    const keyMap = {
      'style.less': 'Style',
      'template.marko': 'Template',
      'index.js': 'Index',
      'browser.json': 'Browser',
    };
    const viewName = id => {
      const name = byId(id).name;
      return keyMap[name] || name;
    };
    const views = ele.children
      .filter(cid => byId(cid).type === 'file')
      .map(cid => ({ key: viewName(cid).toLowerCase(), target: cid, name: viewName(cid) }));
    if (views.length) views[0].isDefault = true;
    const p = {
      id: `v:${ele.id}`,
      name: ele.name,
      type,
      icon: iconMap[type],
      tabIconColor: colorMap[type],
      navigable: true,
      views: [{ key: 'diagram', name: 'Diagram' }, ...views],
      parts: ele.children.filter(cid => byId(cid).type === 'file'),
    };
    setById(p.id, p);
    return p;
  });
  return children.map(c => c.id);
};

const getRoutesNode = () => {
  return {
    id: 'v:routes',
    name: 'Routes',
    type: 'routes',
    icon: iconMap.routes,
    iconColor: colorMap.routes,
    views: [{ key: 'rules', name: 'Rules' }, { key: 'code', name: 'Code', target: 'routes.json' }],
  };
};
const getPagesNode = () => {
  return {
    id: 'v:pages',
    name: 'Pages',
    type: 'pages',
    icon: iconMap.page,
    iconColor: colorMap.page,
    children: getElements('src/pages', 'page'),
  };
};
const getUiModulesNode = () => {
  return {
    id: 'v:ui-modules',
    name: 'UI Modules',
    type: 'ui-modules',
    icon: iconMap['ui-modules'],
    iconColor: colorMap['ui-modules'],
    children: getElements('src/ui-modules', 'ui-module'),
  };
};
const getLayoutsNode = () => {
  return {
    id: 'v:layouts',
    name: 'Layouts',
    type: 'layouts',
    icon: iconMap.layout,
    iconColor: colorMap.layout,
    children: getElements('src/layouts', 'layout'),
  };
};
const getServicesNode = () => {
  return {
    id: 'v:misc',
    type: 'services',
    name: 'Services',
    icon: iconMap.services,
    iconColor: colorMap.services,
    children: getElements('src/services', 'service'),
  };
};

const getOthersNode = () => {
  return {
    id: 'v:others',
    type: 'folder-alias',
    name: 'Others',
    icon: iconMap.others,
    iconColor: colorMap.others,
    children: _.without(rawElements, 'src/layouts', 'src/pages', 'src/services', 'src/ui-modules'),
  };
};

export default {
  processProjectData(prjData) {
    byId = id => prjData.elementById[id];
    setById = (id, ele) => (prjData.elementById[id] = ele);
    rawElements = prjData.elements.slice();

    const routesNode = getRoutesNode();
    const pagesNode = getPagesNode();
    const uiModulesNode = getUiModulesNode();
    const layoutsNode = getLayoutsNode();
    const servicesNode = getServicesNode();
    const othersNode = getOthersNode();

    routesNode.count = prjData.routes.length;
    pagesNode.count = pagesNode.children.length;
    uiModulesNode.count = uiModulesNode.children.length;
    layoutsNode.count = layoutsNode.children.length;
    servicesNode.count = servicesNode.children.length;

    const rootChildren = [
      routesNode,
      pagesNode,
      uiModulesNode,
      layoutsNode,
      servicesNode,
      othersNode,
    ];
    rootChildren.forEach(c => (prjData.elementById[c.id] = c));
    prjData.elements = rootChildren.map(c => c.id);

    Object.values(prjData.elementById).forEach(ele => {
      switch (ele.type) {
        case 'ui-module':
        case 'service':
        case 'layoutt':
        case 'file':
        case 'routes':
          ele.navigable = true;
          break;
        default:
          break;
      }
    });
  },
};
<|endoftext|>


<commit_before>/*
 *  ===========================
 *     _   _  _   _   _
 *    |_˩ |_ |_˩ | | |_˩ |\ |
 *    | \ |_ |_˥ |_| | \ | \|
 *
 *      -- CREATIVE LAB --
 *
 *  ===========================
 *
 *
 *  Project: Reborn blank
 *  Version: 0.1.1
 *  Last change: 16/03/2014
 *
 */
'use strict';
module.exports = function(grunt) {
  /**
   *
   *   Load nodejs modules
   *
   */
  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);
  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);
  grunt.loadNpmTasks('assemble');
  // Define the configuration for all the tasks
  grunt.initConfig({
    /**
     *
     * Project settings
     *
     */
    globalDir: {
      // DESC: Configurable paths
      dev: 'dev',
      prod: 'prod'
    },
    /**
     *
     *   HTML
     *
     */
    // DESC: minifies html
    htmlmin: {
      dev: {
        options: {
          // collapseBooleanAttributes: true,
          // collapseWhitespace: true,
          // removeAttributeQuotes: true,
          // removeCommentsFromCDATA: true,
          // removeEmptyAttributes: true,
          // removeOptionalTags: true,
          // removeRedundantAttributes: true,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%= globalDir.prod %>',
          src: '{,*/}*.html',
          dest: '<%= globalDir.prod %>'
        }]
      }
    },
    // DESC: includes partials
    assemble: {
      options: {
        layoutdir: '<%= globalDir.dev %>/layouts',
        partials: '<%= globalDir.dev %>/partials/**/*.hbs',
        flatten: true,
        ext: '.html'
      },
      dev: {
        files: {
          '<%= globalDir.dev %>/': ['<%= globalDir.dev %>/pages/*.hbs']
        }
      }
    },
    /**
     * [DEPRECATED]
     */
    // DESC: includes partials
    // htmlbuild: {
    //   options: {
    //     sections: {
    //       header: '<%= globalDir.dev %>/partials/header.html',
    //       footer: '<%= globalDir.dev %>/partials/footer.html'
    //     }
    //   },
    //   dev: {
    //     src: '<%= globalDir.dev %>/layouts/*.html',
    //     dest: '<%= globalDir.dev %>/'
    //   }
    // },
    /**
     *
     *   CSS
     *
     */
    sass: {
      dev: {
        options: {
          sourceComments: 'map'
        },
        files: {
          '<%= globalDir.dev %>/css/main.css': '<%= globalDir.dev %>/sass/main.scss'
        }
      },
      prod: {
        options: {
          sourceComments: 'none',
          outputStyle: 'compressed'
        },
        files: {
          '<%= globalDir.prod %>/css/main.css': '<%= globalDir.dev %>/sass/main.scss'
        }
      }
    },
    /**
     *
     *   Javascript
     *
     */
    // DESC: Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish'),
        force: true
      },
      all: ['Gruntfile.js', '<%= globalDir.dev %>/scripts/{,*/}*.js', '!<%= globalDir.dev %>/scripts/vendor/*']
    },
    /**
     *
     *   Images
     *
     */
    // DESC: The following *-min tasks produce minified files in the dev folder
    imagemin: {
      dev: {
        files: [{
          expand: true,
          cwd: '<%= globalDir.dev %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%= globalDir.prod %>/images'
        }]
      }
    },
    svgmin: {
      dev: {
        files: [{
          expand: true,
          cwd: '<%= globalDir.dev %>/images',
          src: '{,*/}*.svg',
          dest: '<%= globalDir.prod %>/images'
        }]
      }
    },
    // DESC: to make sprites run 'grunt sprite'
    sprite: {
      dev: {
        src: '<%= globalDir.dev %>/images/sprites/*.png',
        destImg: '<%= globalDir.dev %>/images/spritesheet.png',
        destCSS: '<%= globalDir.dev %>/sass/ui/_sprites.scss',
        padding: 2,
        'algorithm': 'binary-tree',
        'cssFormat': 'scss',
        'cssVarMap': function(sprite) { //mapuje nazwy zmiennych w .scss
          sprite.name = 'sprite-' + sprite.name;
        },
        'cssTemplate': 'sprites.mustache',
        'cssOpts': {
          'cssClass': function(item) {
            return '.icon-' + item.name;
          }
        }
      }
    },
    /**
     *
     *   Vendor libraries
     *
     */
    // DESC: Automatically inject Bower components into the HTML file
    'bower-install': {
      dev: {
        html: '<%= globalDir.dev %>/index.html',
        ignorePath: '<%= globalDir.dev %>/'
      }
    },
    /**
     *
     *   Other
     *
     */
    // DESC: 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: {
      options: {
        dest: '<%= globalDir.prod %>'
      },
      html: '<%= globalDir.dev %>/index.html'
    },
    // DESC: Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      options: {
        assetsDirs: ['<%= globalDir.prod %>']
      },
      html: ['<%= globalDir.prod %>/{,*/}*.html'],
      css: ['<%= globalDir.prod %>/css/{,*/}*.css']
    },
    // DESC: Renames files for browser caching purposes
    rev: {
      dev: {
        files: {
          src: ['<%= globalDir.prod %>/scripts/{,*/}*.js', '<%= globalDir.prod %>/css/{,*/}*.css', '<%= globalDir.prod %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}', '<%= globalDir.prod %>/sass/fonts/{,*/}*.*']
        }
      }
    },
    // DESC: Copies remaining files to places other tasks can use
    copy: {
      prod: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= globalDir.dev %>',
          dest: '<%= globalDir.prod %>',
          src: ['*.{ico,png,txt}', '.htaccess', 'images/{,*/}*.webp', '*.html', '_fonts/{,*/}*.*']
        }]
      },
      styles: {
        expand: true,
        dot: true,
        cwd: '<%= globalDir.dev %>/sass',
        dest: '.tmp/css/',
        src: '{,*/}*.css'
      }
    },
    replace: {
      html: {
        src: ['<%= globalDir.prod %>/*.html'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/', // destination directory or file
        replacements: [{
          from: '../', // string replacement
          to: ''
        }]
      },
      css: {
        src: ['<%= globalDir.prod %>/css/*.css'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/css/', // destination directory or file
        replacements: [{
          from: '../../', // string replacement
          to: '../'
        }]
      },
      js: {
        src: ['<%= globalDir.prod %>/scripts/*.js'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/scripts/', // destination directory or file
        replacements: [{
          from: '../', // string replacement
          to: ''
        }]
      }
    },
    /**
     *
     *   Production building
     *
     */
    // DESC: Run some tasks in parallel to speed up build process
    concurrent: {
      dev: ['assemble', 'sass:dev'],
      prod: ['copy:prod', 'sass:prod', 'imagemin', 'svgmin'],
      postProd: ['replace:html', 'replace:css', 'replace:js']
    },
    /**
     *
     *   Local prod
     *
     */
    // DESC: Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= globalDir.dev %>/scripts/{,*/}*.js'],
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      // FIXME: increase sass compilation performace without setting spawn: false
      sass: {
        files: ['<%= globalDir.dev %>/sass/**/*.scss'],
        tasks: ['sass:dev'],
        options: {
          livereload: true
        }
      },
      html: {
        files: ['<%= globalDir.dev %>/layouts/*.hbs', '<%= globalDir.dev %>/partials/*.hbs'],
        tasks: ['assemble'],
        options: {
          livereload: true
        }
      },
      sprites: {
        files: ['<%= globalDir.dev %>/images/sprites/*.png'],
        tasks: ['sprite:dev', 'sass:dev'],
        options: {
          livereload: true
        }
      }
    },
    // DESC: The actual grunt prod settings
    connect: {
      options: {
        port: 9000,
        livereload: 35729,
        // Change this to '0.0.0.0' to access the prod from outside
        hostname: '0.0.0.0'
      },
      livereload: {
        options: {
          open: 'http://localhost:<%= connect.options.port %>',
          base: ['.tmp', '<%= globalDir.dev %>']
        }
      },
      dev: {
        options: {
          open: true,
          base: '<%= globalDir.prod %>',
          livereload: false
        }
      }
    },
    // DESC: Empties folders to start fresh
    clean: {
      prod: {
        files: [{
          dot: true,
          src: ['.tmp', '<%= globalDir.prod %>/*', '!<%= globalDir.prod %>/.git*']
        }]
      },
      dev: '.tmp'
    }
  }); // grunt task end
  /**
   *
   *   Grunt registered tasks
   *
   */
  // DESC: grunt serve
  grunt.registerTask('serve', ['clean:dev', 'assemble', 'sass:dev', 'connect:livereload', 'watch']);
  // DESC: grunt build
  grunt.registerTask('build', ['clean:prod', 'assemble', 'useminPrepare', 'concurrent:prod', 'concat', 'cssmin', 'uglify', 'usemin', 'concurrent:postProd']);
  // DESC: grunt default task
  grunt.registerTask('default', ['newer:jshint', 'build']);
};<commit_msg>Gruntfile fixes<commit_after>/*
 *  ===========================
 *     _   _  _   _   _
 *    |_˩ |_ |_˩ | | |_˩ |\ |
 *    | \ |_ |_˥ |_| | \ | \|
 *
 *      -- CREATIVE LAB --
 *
 *  ===========================
 *
 *
 *  Project: Reborn blank
 *  Version: 0.1.1
 *  Last change: 16/03/2014
 *
 */
'use strict';
module.exports = function(grunt) {
  /**
   *
   *   Load nodejs modules
   *
   */
  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);
  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);
  grunt.loadNpmTasks('assemble');
  // Define the configuration for all the tasks
  grunt.initConfig({
    /**
     *
     * Project settings
     *
     */
    globalDir: {
      // DESC: Configurable paths
      dev: 'dev',
      prod: 'prod'
    },
    /**
     *
     *   HTML
     *
     */
    // DESC: minifies html
    htmlmin: {
      dev: {
        options: {
          // collapseBooleanAttributes: true,
          // collapseWhitespace: true,
          // removeAttributeQuotes: true,
          // removeCommentsFromCDATA: true,
          // removeEmptyAttributes: true,
          // removeOptionalTags: true,
          // removeRedundantAttributes: true,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%= globalDir.prod %>',
          src: '{,*/}*.html',
          dest: '<%= globalDir.prod %>'
        }]
      }
    },
    // DESC: includes partials
    assemble: {
      options: {
        layoutdir: '<%= globalDir.dev %>/layouts',
        partials: '<%= globalDir.dev %>/partials/**/*.hbs',
        flatten: true,
        ext: '.html'
      },
      dev: {
        files: {
          '<%= globalDir.dev %>/': ['<%= globalDir.dev %>/pages/*.hbs']
        }
      }
    },
    /**
     * [DEPRECATED]
     */
    // DESC: includes partials
    // htmlbuild: {
    //   options: {
    //     sections: {
    //       header: '<%= globalDir.dev %>/partials/header.html',
    //       footer: '<%= globalDir.dev %>/partials/footer.html'
    //     }
    //   },
    //   dev: {
    //     src: '<%= globalDir.dev %>/layouts/*.html',
    //     dest: '<%= globalDir.dev %>/'
    //   }
    // },
    /**
     *
     *   CSS
     *
     */
    sass: {
      dev: {
        options: {
          sourceComments: 'map'
        },
        files: {
          '<%= globalDir.dev %>/css/main.css': '<%= globalDir.dev %>/sass/main.scss'
        }
      },
      prod: {
        options: {
          sourceComments: 'none',
          outputStyle: 'compressed'
        },
        files: {
          '<%= globalDir.prod %>/css/main.css': '<%= globalDir.dev %>/sass/main.scss'
        }
      }
    },
    /**
     *
     *   Javascript
     *
     */
    // DESC: Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish'),
        force: true
      },
      all: ['Gruntfile.js', '<%= globalDir.dev %>/scripts/{,*/}*.js', '!<%= globalDir.dev %>/scripts/vendor/*']
    },
    /**
     *
     *   Images
     *
     */
    // DESC: The following *-min tasks produce minified files in the dev folder
    imagemin: {
      dev: {
        files: [{
          expand: true,
          cwd: '<%= globalDir.dev %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%= globalDir.prod %>/images'
        }]
      }
    },
    svgmin: {
      dev: {
        files: [{
          expand: true,
          cwd: '<%= globalDir.dev %>/images',
          src: '{,*/}*.svg',
          dest: '<%= globalDir.prod %>/images'
        }]
      }
    },
    // DESC: to make sprites run 'grunt sprite'
    sprite: {
      dev: {
        src: '<%= globalDir.dev %>/images/sprites/*.png',
        destImg: '<%= globalDir.dev %>/images/spritesheet.png',
        destCSS: '<%= globalDir.dev %>/sass/ui/_sprites.scss',
        padding: 2,
        'algorithm': 'binary-tree',
        'cssFormat': 'scss',
        'cssVarMap': function(sprite) { //mapuje nazwy zmiennych w .scss
          sprite.name = 'sprite-' + sprite.name;
        },
        'cssTemplate': 'sprites.mustache',
        'cssOpts': {
          'cssClass': function(item) {
            return '.icon-' + item.name;
          }
        }
      }
    },
    /**
     *
     *   Vendor libraries
     *
     */
    // DESC: Automatically inject Bower components into the HTML file
    'bower-install': {
      dev: {
        html: '<%= globalDir.dev %>/index.html',
        ignorePath: '<%= globalDir.dev %>/'
      }
    },
    /**
     *
     *   Other
     *
     */
    // DESC: 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: {
      options: {
        dest: '<%= globalDir.prod %>'
      },
      html: '<%= globalDir.dev %>/index.html'
    },
    // DESC: Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      options: {
        assetsDirs: ['<%= globalDir.prod %>']
      },
      html: ['<%= globalDir.prod %>/{,*/}*.html'],
      css: ['<%= globalDir.prod %>/css/{,*/}*.css']
    },
    // DESC: Renames files for browser caching purposes
    rev: {
      dev: {
        files: {
          src: ['<%= globalDir.prod %>/scripts/{,*/}*.js', '<%= globalDir.prod %>/css/{,*/}*.css', '<%= globalDir.prod %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}', '<%= globalDir.prod %>/sass/fonts/{,*/}*.*']
        }
      }
    },
    // DESC: Copies remaining files to places other tasks can use
    copy: {
      prod: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= globalDir.dev %>',
          dest: '<%= globalDir.prod %>',
          src: ['*.{ico,png,txt}', '.htaccess', 'images/{,*/}*.webp', '*.html', '_fonts/{,*/}*.*']
        }]
      },
      styles: {
        expand: true,
        dot: true,
        cwd: '<%= globalDir.dev %>/sass',
        dest: '.tmp/css/',
        src: '{,*/}*.css'
      }
    },
    replace: {
      html: {
        src: ['<%= globalDir.prod %>/*.html'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/', // destination directory or file
        replacements: [{
          from: '../', // string replacement
          to: ''
        }]
      },
      css: {
        src: ['<%= globalDir.prod %>/css/*.css'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/css/', // destination directory or file
        replacements: [{
          from: '../../', // string replacement
          to: '../'
        }]
      },
      js: {
        src: ['<%= globalDir.prod %>/scripts/*.js'], // source files array (supports minimatch)
        dest: '<%= globalDir.prod %>/scripts/', // destination directory or file
        replacements: [{
          from: '../', // string replacement
          to: ''
        }]
      }
    },
    /**
     *
     *   Production building
     *
     */
    // DESC: Run some tasks in parallel to speed up build process
    concurrent: {
      dev: ['assemble', 'sass:dev'],
      prod: ['copy:prod', 'sass:prod', 'imagemin', 'svgmin'],
      postProd: ['replace:html', 'replace:css', 'replace:js']
    },
    /**
     *
     *   Local prod
     *
     */
    // DESC: Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= globalDir.dev %>/scripts/{,*/}*.js'],
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      // FIXME: increase sass compilation performace without setting spawn: false
      sass: {
        files: ['<%= globalDir.dev %>/sass/**/*.scss'],
        tasks: ['sass:dev'],
        options: {
          livereload: true
        }
      },
      html: {
        files: ['<%= globalDir.dev %>/layouts/*.hbs', '<%= globalDir.dev %>/partials/*.hbs', '<%= globalDir.dev %>/pages/*.hbs'],
        tasks: ['assemble'],
        options: {
          livereload: true
        }
      },
      sprites: {
        files: ['<%= globalDir.dev %>/images/sprites/*.png'],
        tasks: ['sprite:dev', 'sass:dev'],
        options: {
          livereload: true
        }
      }
    },
    // DESC: The actual grunt prod settings
    connect: {
      options: {
        port: 9000,
        livereload: 35729,
        // Change this to '0.0.0.0' to access the prod from outside
        hostname: '0.0.0.0'
      },
      livereload: {
        options: {
          open: 'http://localhost:<%= connect.options.port %>',
          base: ['.tmp', '<%= globalDir.dev %>']
        }
      },
      dev: {
        options: {
          open: true,
          base: '<%= globalDir.prod %>',
          livereload: false
        }
      }
    },
    // DESC: Empties folders to start fresh
    clean: {
      prod: {
        files: [{
          dot: true,
          src: ['.tmp', '<%= globalDir.prod %>/*', '!<%= globalDir.prod %>/.git*']
        }]
      },
      dev: '.tmp'
    }
  }); // grunt task end
  /**
   *
   *   Grunt registered tasks
   *
   */
  // DESC: grunt serve
  grunt.registerTask('serve', ['clean:dev', 'assemble', 'sass:dev', 'connect:livereload', 'watch']);
  // DESC: grunt build
  grunt.registerTask('build', ['clean:prod', 'assemble', 'useminPrepare', 'concurrent:prod', 'concat', 'cssmin', 'uglify', 'usemin', 'concurrent:postProd']);
  // DESC: grunt default task
  grunt.registerTask('default', ['newer:jshint', 'build']);
};<|endoftext|>


<commit_before>(function(){
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
// load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  grunt.initConfig({
    watch: {
      options: {
        nospawn: true,
        livereload: LIVERELOAD_PORT
      },
      css: { // watch all .sass files and call the sass task to convert them to .stylesheets
        files: 'stylesheets/sass/*.sass',
        tasks: ['sass', 'minifyCss']
      },
      scripts: {
        files: ['js/*.js', 'test/*Spec.js'],
        tasks: ['test', 'jshint', 'minifyJs']
      },
      livereload: {
        files: [
          'index.html',
          'stylesheets/css/*.css', // reload converted .css file
          'js/*.js'
        ]
      }
    },
    connect: {
      options: {
        port: 9000,
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:<%%= connect.options.port %>'
      }
    },
    sass: {
      dist: {
        options: {
          style: 'expanded'
        },
        files: {
          'stylesheets/css/style.css': 'stylesheets/sass/style.sass',
          'stylesheets/css/reset.css': 'stylesheets/sass/reset.sass',
          'stylesheets/bootstrap-sass-official/bootstrap.css': 'bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
        }
      }
    },
    jasmine: {
      pivotal: {
        src: 'js/**/*.js',
        options: {
          specs: 'test/*Spec.js',
          helpers: 'test/*Helper.js'
        }
      }
    },
    jshint: {
      all: ['js/*.js', 'test/*.js']
    },
    concat: {
      options: {
        separator: ";"
      },
      dist: {
        src: [
          'js/**/*.js',
        ],
        dest: 'js/concat.js'
      }
    },
    uglify: {
      options: {
        compress: {
          drop_console: true //removes all console.log, console.table ...
        }
      },
      my_target: {
        files: {
          'js/minify/minify.min.js': ['js/concat.js']
        }
      }
    },
    cssmin: {
      combine: {
        files: {
          'stylesheets/css/minify/minify.css': ['stylesheets/css/style.css', 'stylesheets/css/reset.css']
        }
      }
    }
  });

  grunt.registerTask('test', ['jasmine']);
  grunt.registerTask('build', ['concat', 'uglify', 'sass', 'cssmin']);
  grunt.registerTask('server', ['connect:livereload', 'open', 'watch']);
  grunt.registerTask('hint', ['jshint']);
  grunt.registerTask('con', ['concat']);
  grunt.registerTask('minifyJs', ['uglify']);
  grunt.registerTask('minifyCss', ['cssmin']);
};
})();<commit_msg>included build to server<commit_after>(function(){
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
// load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  grunt.initConfig({
    watch: {
      options: {
        nospawn: true,
        livereload: LIVERELOAD_PORT
      },
      css: { // watch all .sass files and call the sass task to convert them to .stylesheets
        files: 'stylesheets/sass/*.sass',
        tasks: ['sass', 'minifyCss']
      },
      scripts: {
        files: ['js/*.js', 'test/*Spec.js'],
        tasks: ['test', 'jshint', 'minifyJs']
      },
      livereload: {
        files: [
          'index.html',
          'stylesheets/css/*.css', // reload converted .css file
          'js/*.js'
        ]
      }
    },
    connect: {
      options: {
        port: 9000,
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:<%%= connect.options.port %>'
      }
    },
    sass: {
      dist: {
        options: {
          style: 'expanded'
        },
        files: {
          'stylesheets/css/style.css': 'stylesheets/sass/style.sass',
          'stylesheets/css/reset.css': 'stylesheets/sass/reset.sass',
          'stylesheets/bootstrap-sass-official/bootstrap.css': 'bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
        }
      }
    },
    jasmine: {
      pivotal: {
        src: 'js/**/*.js',
        options: {
          specs: 'test/*Spec.js',
          helpers: 'test/*Helper.js'
        }
      }
    },
    jshint: {
      all: ['js/*.js', 'test/*.js']
    },
    concat: {
      options: {
        separator: ";"
      },
      dist: {
        src: [
          'js/**/*.js',
        ],
        dest: 'js/concat.js'
      }
    },
    uglify: {
      options: {
        compress: {
          drop_console: true //removes all console.log, console.table ...
        }
      },
      my_target: {
        files: {
          'js/minify/minify.min.js': ['js/concat.js']
        }
      }
    },
    cssmin: {
      combine: {
        files: {
          'stylesheets/css/minify/minify.css': ['stylesheets/css/style.css', 'stylesheets/css/reset.css']
        }
      }
    }
  });

  grunt.registerTask('test', ['jasmine']);
  grunt.registerTask('build', ['concat', 'uglify', 'sass', 'cssmin']);
  grunt.registerTask('server', ['build','connect:livereload', 'open', 'watch']);
  grunt.registerTask('hint', ['jshint']);
  grunt.registerTask('con', ['concat']);
  grunt.registerTask('minifyJs', ['uglify']);
  grunt.registerTask('minifyCss', ['cssmin']);
};
})();<|endoftext|>


<commit_before>/*jshint node:true*/

// Generated on <%= (new Date).toISOString().split('T')[0] %> using
// <%= pkg.name %> <%= pkg.version %>
'use strict';

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

module.exports = function (grunt) {

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

  // Automatically load required grunt tasks
  require('jit-grunt')(grunt, {
      useminPrepare: 'grunt-usemin'
  });

  // Configurable paths
  var config = {
    app: 'app',
    dist: 'dist'
  };

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

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },<% if (useBabel) { %>
      babel: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['babel:dist']
      },
      babelTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['babel:test', 'test:watch']
      },<% } else { %>
      js: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['jshint']
      },
      jstest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['test:watch']
      },<% } %>
      gruntfile: {
        files: ['Gruntfile.js']
      },<% if (includeSass) { %>
      sass: {
        files: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },<% } %>
      styles: {
        files: ['<%%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      }
    },

    browserSync: {
      options: {
        notify: false,
        background: true
      },
      livereload: {
        options: {
          files: [
            '<%%= config.app %>/{,*/}*.html',
            '.tmp/styles/{,*/}*.css',
            '<%%= config.app %>/images/{,*/}*',
            '<%%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['.tmp', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      test: {
        options: {
          port: 9001,
          open: false,
          logLevel: 'silent',
          host: 'localhost',
          server: {<% if (testFramework === 'mocha') { %>
            baseDir: ['.tmp', './test', config.app],<% } else if (testFramework === 'jasmine') { %>
            baseDir: ['./'],<% } %>
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      dist: {
        options: {
          background: false,
          server: '<%%= config.dist %>'
        }
      }
    },

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

    // 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',
        '<%%= config.app %>/scripts/{,*/}*.js',
        '!<%%= config.app %>/scripts/vendor/*',
        'test/spec/{,*/}*.js'
      ]
    },<% if (testFramework === 'mocha') { %>

    // Mocha testing framework configuration options
    mocha: {
      all: {
        options: {
          run: true,
          urls: ['http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>/index.html']
        }
      }
    },<% } else if (testFramework === 'jasmine') { %>

    // Jasmine testing framework configuration options
    jasmine: {
      all: {
        src: '{<%= config.app %>,.tmp}/scripts/{,*/}*.js',
        options: {
          vendor: [
            // Your bower_components scripts
          ],
          specs: '{test,.tmp}/spec/{,*/}*.js',
          helpers: '{test,.tmp}/helpers/{,*/}*.js',
          host: 'http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>'
        }
      }
    },<% } %><% if (useBabel) { %>

    // Compiles ES6 with Babel
    babel: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/scripts',
          src: '{,*/}*.js',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.js',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },<% } %><% if (includeSass) { %>

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

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']<% if (includeSass) { %>,
        map: {
          prev: '.tmp/styles/'
        }
        <% } %>
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      app: {
        ignorePath: /^<%%= config.app %>\/|\.\.\//,
        src: ['<%%= config.app %>/index.html']<% if (includeBootstrap) { %>,<% if (includeSass) { %>
        exclude: ['bower_components/bootstrap-sass/assets/javascripts/bootstrap.js']<% } else { %>
        exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']<% } } %>
      }<% if (includeSass) { %>,
      sass: {
        src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }<% } %>
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%%= config.dist %>/scripts/{,*/}*.js',
          '<%%= config.dist %>/styles/{,*/}*.css',
          '<%%= config.dist %>/images/{,*/}*.*',
          '<%%= config.dist %>/styles/fonts/{,*/}*.*',
          '<%%= config.dist %>/*.{ico,png}'
        ]
      }
    },

    // 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: {
      options: {
        dest: '<%%= config.dist %>'
      },
      html: '<%%= config.app %>/index.html'
    },

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%%= config.dist %>/images'
        }]
      }
    },

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

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          conservativeCollapse: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          // true would impact styles with attribute selectors
          removeRedundantAttributes: false,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%%= config.dist %>'
        }]
      }
    },

    // 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: {
    //       '<%%= config.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%%= config.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%%= config.dist %>/scripts/scripts.js': [
    //         '<%%= config.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%%= config.app %>',
          dest: '<%%= config.dist %>',
          src: [
            '*.{ico,png,txt}',
            'images/{,*/}*.webp',
            '{,*/}*.html',
            'styles/fonts/{,*/}*.*'
          ]
        }<% if (includeBootstrap) { %>, {
          expand: true,
          dot: true,
          cwd: '<% if (includeSass) {
              %>.<%
            } else {
              %>bower_components/bootstrap/dist<%
            } %>',
          src: '<% if (includeSass) {
              %>bower_components/bootstrap-sass/assets/fonts/bootstrap/*<%
            } else {
              %>fonts/*<%
            } %>',
          dest: '<%%= config.dist %>'
        }<% } %>]
      }<% if (!includeSass) { %>,
      styles: {
        expand: true,
        dot: true,
        cwd: '<%%= config.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }<% } %>
    },<% if (includeModernizr) { %>

    // Generates a custom Modernizr build that includes only the tests you
    // reference in your app
    modernizr: {
      dist: {
        devFile: 'bower_components/modernizr/modernizr.js',
        outputFile: '<%%= config.dist %>/scripts/vendor/modernizr.js',
        files: {
          src: [
            '<%%= config.dist %>/scripts/{,*/}*.js',
            '<%%= config.dist %>/styles/{,*/}*.css',
            '!<%%= config.dist %>/scripts/vendor/*'
          ]
        },
        uglify: true
      }
    },<% } %>

    // Run some tasks in parallel to speed up build process
    concurrent: {
      server: [<% if (useBabel) { %>
        'babel:dist',<% } %><% if (includeSass) { %>
        'sass:server'<% } else { %>
        'copy:styles'<% } %>
      ],
      test: [<% if (useBabel) { %>
        'babel'<% } %><% if (useBabel && !includeSass) { %>,<% } %><% if (!includeSass) { %>
        'copy:styles'<% } %>
      ],
      dist: [<% if (useBabel) { %>
        'babel',<% } %><% if (includeSass) { %>
        'sass',<% } else { %>
        'copy:styles',<% } %>
        'imagemin',
        'svgmin'
      ]
    }
  });

  grunt.registerTask('serve', 'start the server and preview your app', function (target) {

    if (target === 'dist') {
      return grunt.task.run(['build', 'browserSync:dist']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'browserSync: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([target ? ('serve:' + target) : 'serve']);
  });

  grunt.registerTask('test', function (target) {
    if (target !== 'watch') {
      grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer'
      ]);
    }

    grunt.task.run([
      'browserSync:test',<% if (testFramework === 'mocha') { %>
      'mocha'<% } else if (testFramework === 'jasmine') { %>
      'jasmine'<% } %>
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',<% if (includeModernizr) { %>
    'modernizr',<% } %>
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Remove nonexistent option<commit_after>/*jshint node:true*/

// Generated on <%= (new Date).toISOString().split('T')[0] %> using
// <%= pkg.name %> <%= pkg.version %>
'use strict';

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

module.exports = function (grunt) {

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

  // Automatically load required grunt tasks
  require('jit-grunt')(grunt, {
      useminPrepare: 'grunt-usemin'
  });

  // Configurable paths
  var config = {
    app: 'app',
    dist: 'dist'
  };

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

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },<% if (useBabel) { %>
      babel: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['babel:dist']
      },
      babelTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['babel:test', 'test:watch']
      },<% } else { %>
      js: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['jshint']
      },
      jstest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['test:watch']
      },<% } %>
      gruntfile: {
        files: ['Gruntfile.js']
      },<% if (includeSass) { %>
      sass: {
        files: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },<% } %>
      styles: {
        files: ['<%%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      }
    },

    browserSync: {
      options: {
        notify: false,
        background: true
      },
      livereload: {
        options: {
          files: [
            '<%%= config.app %>/{,*/}*.html',
            '.tmp/styles/{,*/}*.css',
            '<%%= config.app %>/images/{,*/}*',
            '<%%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['.tmp', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      test: {
        options: {
          port: 9001,
          open: false,
          logLevel: 'silent',
          host: 'localhost',
          server: {<% if (testFramework === 'mocha') { %>
            baseDir: ['.tmp', './test', config.app],<% } else if (testFramework === 'jasmine') { %>
            baseDir: ['./'],<% } %>
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      dist: {
        options: {
          background: false,
          server: '<%%= config.dist %>'
        }
      }
    },

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

    // 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',
        '<%%= config.app %>/scripts/{,*/}*.js',
        '!<%%= config.app %>/scripts/vendor/*',
        'test/spec/{,*/}*.js'
      ]
    },<% if (testFramework === 'mocha') { %>

    // Mocha testing framework configuration options
    mocha: {
      all: {
        options: {
          run: true,
          urls: ['http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>/index.html']
        }
      }
    },<% } else if (testFramework === 'jasmine') { %>

    // Jasmine testing framework configuration options
    jasmine: {
      all: {
        src: '{<%= config.app %>,.tmp}/scripts/{,*/}*.js',
        options: {
          vendor: [
            // Your bower_components scripts
          ],
          specs: '{test,.tmp}/spec/{,*/}*.js',
          helpers: '{test,.tmp}/helpers/{,*/}*.js',
          host: 'http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>'
        }
      }
    },<% } %><% if (useBabel) { %>

    // Compiles ES6 with Babel
    babel: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/scripts',
          src: '{,*/}*.js',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.js',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },<% } %><% if (includeSass) { %>

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

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']<% if (includeSass) { %>,
        map: {
          prev: '.tmp/styles/'
        }
        <% } %>
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      app: {
        ignorePath: /^<%%= config.app %>\/|\.\.\//,
        src: ['<%%= config.app %>/index.html']<% if (includeBootstrap) { %>,<% if (includeSass) { %>
        exclude: ['bower_components/bootstrap-sass/assets/javascripts/bootstrap.js']<% } else { %>
        exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']<% } } %>
      }<% if (includeSass) { %>,
      sass: {
        src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }<% } %>
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%%= config.dist %>/scripts/{,*/}*.js',
          '<%%= config.dist %>/styles/{,*/}*.css',
          '<%%= config.dist %>/images/{,*/}*.*',
          '<%%= config.dist %>/styles/fonts/{,*/}*.*',
          '<%%= config.dist %>/*.{ico,png}'
        ]
      }
    },

    // 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: {
      options: {
        dest: '<%%= config.dist %>'
      },
      html: '<%%= config.app %>/index.html'
    },

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%%= config.dist %>/images'
        }]
      }
    },

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

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          conservativeCollapse: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          // true would impact styles with attribute selectors
          removeRedundantAttributes: false,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%%= config.dist %>'
        }]
      }
    },

    // 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: {
    //       '<%%= config.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%%= config.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%%= config.dist %>/scripts/scripts.js': [
    //         '<%%= config.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%%= config.app %>',
          dest: '<%%= config.dist %>',
          src: [
            '*.{ico,png,txt}',
            'images/{,*/}*.webp',
            '{,*/}*.html',
            'styles/fonts/{,*/}*.*'
          ]
        }<% if (includeBootstrap) { %>, {
          expand: true,
          dot: true,
          cwd: '<% if (includeSass) {
              %>.<%
            } else {
              %>bower_components/bootstrap/dist<%
            } %>',
          src: '<% if (includeSass) {
              %>bower_components/bootstrap-sass/assets/fonts/bootstrap/*<%
            } else {
              %>fonts/*<%
            } %>',
          dest: '<%%= config.dist %>'
        }<% } %>]
      }<% if (!includeSass) { %>,
      styles: {
        expand: true,
        dot: true,
        cwd: '<%%= config.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }<% } %>
    },<% if (includeModernizr) { %>

    // Generates a custom Modernizr build that includes only the tests you
    // reference in your app
    modernizr: {
      dist: {
        devFile: 'bower_components/modernizr/modernizr.js',
        outputFile: '<%%= config.dist %>/scripts/vendor/modernizr.js',
        files: {
          src: [
            '<%%= config.dist %>/scripts/{,*/}*.js',
            '<%%= config.dist %>/styles/{,*/}*.css',
            '!<%%= config.dist %>/scripts/vendor/*'
          ]
        },
        uglify: true
      }
    },<% } %>

    // Run some tasks in parallel to speed up build process
    concurrent: {
      server: [<% if (useBabel) { %>
        'babel:dist',<% } %><% if (includeSass) { %>
        'sass:server'<% } else { %>
        'copy:styles'<% } %>
      ],
      test: [<% if (useBabel) { %>
        'babel'<% } %><% if (useBabel && !includeSass) { %>,<% } %><% if (!includeSass) { %>
        'copy:styles'<% } %>
      ],
      dist: [<% if (useBabel) { %>
        'babel',<% } %><% if (includeSass) { %>
        'sass',<% } else { %>
        'copy:styles',<% } %>
        'imagemin',
        'svgmin'
      ]
    }
  });

  grunt.registerTask('serve', 'start the server and preview your app', function (target) {

    if (target === 'dist') {
      return grunt.task.run(['build', 'browserSync:dist']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'browserSync: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([target ? ('serve:' + target) : 'serve']);
  });

  grunt.registerTask('test', function (target) {
    if (target !== 'watch') {
      grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer'
      ]);
    }

    grunt.task.run([
      'browserSync:test',<% if (testFramework === 'mocha') { %>
      'mocha'<% } else if (testFramework === 'jasmine') { %>
      'jasmine'<% } %>
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',<% if (includeModernizr) { %>
    'modernizr',<% } %>
    'filerev',
    'usemin',
    'htmlmin'
  ]);

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


<commit_before>/*jshint node:true*/

// Generated on <%= (new Date).toISOString().split('T')[0] %> using
// <%= pkg.name %> <%= pkg.version %>
'use strict';

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

module.exports = function (grunt) {

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

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

  // Configurable paths
  var config = {
    app: 'app',
    dist: 'dist'
  };

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

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },<% if (babel) { %>
      babel: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['babel:dist']
      },
      babelTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['babel:test', 'test:watch']
      },<% } else { %>
      js: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['jshint'],
      },
      jstest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['test:watch']
      },<% } %>
      gruntfile: {
        files: ['Gruntfile.js']
      },<% if (includeSass) { %>
      sass: {
        files: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },<% } %>
      styles: {
        files: ['<%%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      }
    },

    browserSync: {
      options: {
        notify: false,
        background: true
      },
      livereload: {
        options: {
          files: [
            '<%%= config.app %>/{,*/}*.html',
            '.tmp/styles/{,*/}*.css',
            '<%%= config.app %>/images/{,*/}*',
            '<%%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['.tmp', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      test: {
        options: {
          port: 9001,
          open: false,
          logLevel: 'silent',
          host: 'localhost',
          server: {
            baseDir: ['.tmp', './test', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      dist: {
        options: {
          background: false,
          server: '<%%= config.dist %>'
        }
      }
    },

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

    // 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',
        '<%%= config.app %>/scripts/{,*/}*.js',
        '!<%%= config.app %>/scripts/vendor/*',
        'test/spec/{,*/}*.js'
      ]
    },<% if (testFramework === 'mocha') { %>

    // Mocha testing framework configuration options
    mocha: {
      all: {
        options: {
          run: true,
          urls: ['http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>/index.html']
        }
      }
    },<% } else if (testFramework === 'jasmine') { %>

    // Jasmine testing framework configuration options
    jasmine: {
      all: {
        options: {
          specs: 'test/spec/{,*/}*.js'
        }
      }
    },<% } %><% if (babel) { %>

    // Compiles ES6 with Babel
    babel: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/scripts',
          src: '{,*/}*.js',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.js',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },<% } %><% if (includeSass) { %>

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

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']<% if (includeSass) { %>,
        map: {
          prev: '.tmp/styles/'
        }
        <% } %>
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      app: {
        ignorePath: /^<%= config.app %>\/|\.\.\//,
        src: ['<%%= config.app %>/index.html']<% if (includeBootstrap) { %>,<% if (includeSass) { %>
        exclude: ['bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js']<% } else { %>
        exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']<% } } %>
      }<% if (includeSass) { %>,
      sass: {
        src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }<% } %>
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%%= config.dist %>/scripts/{,*/}*.js',
          '<%%= config.dist %>/styles/{,*/}*.css',
          '<%%= config.dist %>/images/{,*/}*.*',
          '<%%= config.dist %>/styles/fonts/{,*/}*.*',
          '<%%= config.dist %>/*.{ico,png}'
        ]
      }
    },

    // 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: {
      options: {
        dest: '<%%= config.dist %>'
      },
      html: '<%%= config.app %>/index.html'
    },

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%%= config.dist %>/images'
        }]
      }
    },

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

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          conservativeCollapse: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          // true would impact styles with attribute selectors
          removeRedundantAttributes: false,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%%= config.dist %>'
        }]
      }
    },

    // 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: {
    //       '<%%= config.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%%= config.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%%= config.dist %>/scripts/scripts.js': [
    //         '<%%= config.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%%= config.app %>',
          dest: '<%%= config.dist %>',
          src: [
            '*.{ico,png,txt}',
            'images/{,*/}*.webp',
            '{,*/}*.html',
            'styles/fonts/{,*/}*.*'
          ]
        }<% if (includeBootstrap) { %>, {
          expand: true,
          dot: true,
          cwd: '<% if (includeSass) {
              %>.<%
            } else {
              %>bower_components/bootstrap/dist<%
            } %>',
          src: '<% if (includeSass) {
              %>bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*<%
            } else {
              %>fonts/*<%
            } %>',
          dest: '<%%= config.dist %>'
        }<% } %>]
      }<% if (!includeSass) { %>,
      styles: {
        expand: true,
        dot: true,
        cwd: '<%%= config.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }<% } %>
    },<% if (includeModernizr) { %>

    // Generates a custom Modernizr build that includes only the tests you
    // reference in your app
    modernizr: {
      dist: {
        devFile: 'bower_components/modernizr/modernizr.js',
        outputFile: '<%%= config.dist %>/scripts/vendor/modernizr.js',
        files: {
          src: [
            '<%%= config.dist %>/scripts/{,*/}*.js',
            '<%%= config.dist %>/styles/{,*/}*.css',
            '!<%%= config.dist %>/scripts/vendor/*'
          ]
        },
        uglify: true
      }
    },<% } %>

    // Run some tasks in parallel to speed up build process
    concurrent: {
      server: [<% if (babel) {  %>
        'babel:dist',<% } %><% if (includeSass) { %>
        'sass:server'<% } else { %>
        'copy:styles'<% } %>
      ],
      test: [<% if (babel) {  %>
        'babel'<% } %><% if (babel && !includeSass) {  %>,<% } %><% if (!includeSass) { %>
        'copy:styles'<% } %>
      ],
      dist: [<% if (babel) {  %>
        'babel',<% } %><% if (includeSass) { %>
        'sass',<% } else { %>
        'copy:styles',<% } %>
        'imagemin',
        'svgmin'
      ]
    }
  });

  grunt.registerTask('serve', 'start the server and preview your app', function (target) {

    if (target === 'dist') {
      return grunt.task.run(['build', 'browserSync:dist']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'browserSync: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([target ? ('serve:' + target) : 'serve']);
  });

  grunt.registerTask('test', function (target) {
    if (target !== 'watch') {
      grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer'
      ]);
    }

    grunt.task.run([
      'browserSync:test',<% if (testFramework === 'mocha') { %>
      'mocha'<% } else if (testFramework === 'jasmine') { %>
      'jasmine'<% } %>
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',<% if (includeModernizr) { %>
    'modernizr',<% } %>
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Remove extra whitespace<commit_after>/*jshint node:true*/

// Generated on <%= (new Date).toISOString().split('T')[0] %> using
// <%= pkg.name %> <%= pkg.version %>
'use strict';

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

module.exports = function (grunt) {

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

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

  // Configurable paths
  var config = {
    app: 'app',
    dist: 'dist'
  };

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

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },<% if (babel) { %>
      babel: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['babel:dist']
      },
      babelTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['babel:test', 'test:watch']
      },<% } else { %>
      js: {
        files: ['<%%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['jshint'],
      },
      jstest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['test:watch']
      },<% } %>
      gruntfile: {
        files: ['Gruntfile.js']
      },<% if (includeSass) { %>
      sass: {
        files: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },<% } %>
      styles: {
        files: ['<%%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      }
    },

    browserSync: {
      options: {
        notify: false,
        background: true
      },
      livereload: {
        options: {
          files: [
            '<%%= config.app %>/{,*/}*.html',
            '.tmp/styles/{,*/}*.css',
            '<%%= config.app %>/images/{,*/}*',
            '<%%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['.tmp', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      test: {
        options: {
          port: 9001,
          open: false,
          logLevel: 'silent',
          host: 'localhost',
          server: {
            baseDir: ['.tmp', './test', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      },
      dist: {
        options: {
          background: false,
          server: '<%%= config.dist %>'
        }
      }
    },

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

    // 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',
        '<%%= config.app %>/scripts/{,*/}*.js',
        '!<%%= config.app %>/scripts/vendor/*',
        'test/spec/{,*/}*.js'
      ]
    },<% if (testFramework === 'mocha') { %>

    // Mocha testing framework configuration options
    mocha: {
      all: {
        options: {
          run: true,
          urls: ['http://<%%= browserSync.test.options.host %>:<%%= browserSync.test.options.port %>/index.html']
        }
      }
    },<% } else if (testFramework === 'jasmine') { %>

    // Jasmine testing framework configuration options
    jasmine: {
      all: {
        options: {
          specs: 'test/spec/{,*/}*.js'
        }
      }
    },<% } %><% if (babel) { %>

    // Compiles ES6 with Babel
    babel: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/scripts',
          src: '{,*/}*.js',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.js',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },<% } %><% if (includeSass) { %>

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

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']<% if (includeSass) { %>,
        map: {
          prev: '.tmp/styles/'
        }
        <% } %>
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      app: {
        ignorePath: /^<%= config.app %>\/|\.\.\//,
        src: ['<%%= config.app %>/index.html']<% if (includeBootstrap) { %>,<% if (includeSass) { %>
        exclude: ['bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js']<% } else { %>
        exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']<% } } %>
      }<% if (includeSass) { %>,
      sass: {
        src: ['<%%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }<% } %>
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%%= config.dist %>/scripts/{,*/}*.js',
          '<%%= config.dist %>/styles/{,*/}*.css',
          '<%%= config.dist %>/images/{,*/}*.*',
          '<%%= config.dist %>/styles/fonts/{,*/}*.*',
          '<%%= config.dist %>/*.{ico,png}'
        ]
      }
    },

    // 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: {
      options: {
        dest: '<%%= config.dist %>'
      },
      html: '<%%= config.app %>/index.html'
    },

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%%= config.dist %>/images'
        }]
      }
    },

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

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          conservativeCollapse: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          // true would impact styles with attribute selectors
          removeRedundantAttributes: false,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%%= config.dist %>'
        }]
      }
    },

    // 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: {
    //       '<%%= config.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%%= config.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%%= config.dist %>/scripts/scripts.js': [
    //         '<%%= config.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%%= config.app %>',
          dest: '<%%= config.dist %>',
          src: [
            '*.{ico,png,txt}',
            'images/{,*/}*.webp',
            '{,*/}*.html',
            'styles/fonts/{,*/}*.*'
          ]
        }<% if (includeBootstrap) { %>, {
          expand: true,
          dot: true,
          cwd: '<% if (includeSass) {
              %>.<%
            } else {
              %>bower_components/bootstrap/dist<%
            } %>',
          src: '<% if (includeSass) {
              %>bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*<%
            } else {
              %>fonts/*<%
            } %>',
          dest: '<%%= config.dist %>'
        }<% } %>]
      }<% if (!includeSass) { %>,
      styles: {
        expand: true,
        dot: true,
        cwd: '<%%= config.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }<% } %>
    },<% if (includeModernizr) { %>

    // Generates a custom Modernizr build that includes only the tests you
    // reference in your app
    modernizr: {
      dist: {
        devFile: 'bower_components/modernizr/modernizr.js',
        outputFile: '<%%= config.dist %>/scripts/vendor/modernizr.js',
        files: {
          src: [
            '<%%= config.dist %>/scripts/{,*/}*.js',
            '<%%= config.dist %>/styles/{,*/}*.css',
            '!<%%= config.dist %>/scripts/vendor/*'
          ]
        },
        uglify: true
      }
    },<% } %>

    // Run some tasks in parallel to speed up build process
    concurrent: {
      server: [<% if (babel) { %>
        'babel:dist',<% } %><% if (includeSass) { %>
        'sass:server'<% } else { %>
        'copy:styles'<% } %>
      ],
      test: [<% if (babel) { %>
        'babel'<% } %><% if (babel && !includeSass) { %>,<% } %><% if (!includeSass) { %>
        'copy:styles'<% } %>
      ],
      dist: [<% if (babel) { %>
        'babel',<% } %><% if (includeSass) { %>
        'sass',<% } else { %>
        'copy:styles',<% } %>
        'imagemin',
        'svgmin'
      ]
    }
  });

  grunt.registerTask('serve', 'start the server and preview your app', function (target) {

    if (target === 'dist') {
      return grunt.task.run(['build', 'browserSync:dist']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'browserSync: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([target ? ('serve:' + target) : 'serve']);
  });

  grunt.registerTask('test', function (target) {
    if (target !== 'watch') {
      grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer'
      ]);
    }

    grunt.task.run([
      'browserSync:test',<% if (testFramework === 'mocha') { %>
      'mocha'<% } else if (testFramework === 'jasmine') { %>
      'jasmine'<% } %>
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',<% if (includeModernizr) { %>
    'modernizr',<% } %>
    'filerev',
    'usemin',
    'htmlmin'
  ]);

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


<commit_before>'use strict';

module.exports = function(grunt){

  /**
   * Load required Grunt tasks. These are installed based on the versions listed
   * in `package.json` when you do `npm install` in this directory.
   */
  require('load-grunt-tasks')(grunt);

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

  /**
   * Configurable paths for the application
   */
  var GruntPathConfig = grunt.file.readJSON('./grunt/config/paths.json');
  var GruntProjectConfig = require('./grunt/config/project.js')(grunt);

  /**
   * Config Tasks
   */
  var ExpressConfig = require('./grunt/task/express.js');
  var LessConfig = require('./grunt/task/less.js');
  var JshintConfig = require('./grunt/task/jshint.js');
  var WiredepConfig = require('./grunt/task/wiredep.js');
  var InjectorConfig = require('./grunt/task/injector.js');
  var WatchConfig = require('./grunt/task/watch.js');

  var CleanConfig = require('./grunt/task/clean.js');
  var CopyConfig = require('./grunt/task/copy.js');
  var ConcatConfig = require('./grunt/task/concat.js');
  var NgAnnotateConfig = require('./grunt/task/ngannotate.js');
  var UglifyConfig = require('./grunt/task/uglify.js');
  var CssMinConfig = require('./grunt/task/cssmin.js');
  var HtmlMinConfig = require('./grunt/task/htmlmin.js');

  var JsDocConfig = require('./grunt/task/jsdoc.js');
  var KarmaConfig = require('./grunt/task/karma.js');

  /**
   * Task Configs
   */
  grunt.config.init(
    grunt.util._.extend(
      GruntPathConfig,
      GruntProjectConfig,
      ExpressConfig,
      LessConfig,
      JshintConfig,
      WiredepConfig,
      InjectorConfig,
      WatchConfig,
      CleanConfig,
      CopyConfig,
      ConcatConfig,
      NgAnnotateConfig,
      UglifyConfig,
      CssMinConfig,
      HtmlMinConfig,
      JsDocConfig,
      KarmaConfig

    )
  );

  /**
   * Task Registration
   */
  grunt.registerTask('index', ['wiredep:app', 'injector:app']);
  grunt.registerTask('style', ['less:app']);

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

  grunt.registerTask('build', [
    'style',
    'jshint:app',
    'index'
  ]);

  grunt.registerTask('serve', [
    'build',
    'express:localDevServer',
    'express-keepalive'
  ]);

  grunt.registerTask('deploy', [
    'build',

    'clean:temp',
    'clean:dist',
    'copy:dist',
    'concat:dist_css',
    'cssmin:dist',

    'concat:dist_js',
    'ngAnnotate:dist',
    'uglify:dist_app',
    'uglify:dist_bower',
    'clean:temp',

    'injector:dist',
    'wiredep:dist',
    'htmlmin:dist_index',
    'htmlmin:dist_tpl'

  ]);

  grunt.registerTask('serve:dist', [
    'deploy',
    'express:localDistServer',
    'express-keepalive'
  ]);

  grunt.registerTask('serve:docs', [
    'express:localDocsServer',
    'express-keepalive'
  ]);

  grunt.registerTask('docs', [
    'clean:docs',
    'jsdoc:app'
  ]);

  grunt.registerTask('test:unit', [
    'karma:unit'
  ]);

  grunt.registerTask('test:midway', [
    'karma:midway'
  ]);

  //grunt.registerTask('test:e2e', [
  //  'karma:e2e'
  //]);

};
<commit_msg>renaming deploy to dist<commit_after>'use strict';

module.exports = function(grunt){

  /**
   * Load required Grunt tasks. These are installed based on the versions listed
   * in `package.json` when you do `npm install` in this directory.
   */
  require('load-grunt-tasks')(grunt);

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

  /**
   * Configurable paths for the application
   */
  var GruntPathConfig = grunt.file.readJSON('./grunt/config/paths.json');
  var GruntProjectConfig = require('./grunt/config/project.js')(grunt);

  /**
   * Config Tasks
   */
  var ExpressConfig = require('./grunt/task/express.js');
  var LessConfig = require('./grunt/task/less.js');
  var JshintConfig = require('./grunt/task/jshint.js');
  var WiredepConfig = require('./grunt/task/wiredep.js');
  var InjectorConfig = require('./grunt/task/injector.js');
  var WatchConfig = require('./grunt/task/watch.js');

  var CleanConfig = require('./grunt/task/clean.js');
  var CopyConfig = require('./grunt/task/copy.js');
  var ConcatConfig = require('./grunt/task/concat.js');
  var NgAnnotateConfig = require('./grunt/task/ngannotate.js');
  var UglifyConfig = require('./grunt/task/uglify.js');
  var CssMinConfig = require('./grunt/task/cssmin.js');
  var HtmlMinConfig = require('./grunt/task/htmlmin.js');

  var JsDocConfig = require('./grunt/task/jsdoc.js');
  var KarmaConfig = require('./grunt/task/karma.js');

  /**
   * Task Configs
   */
  grunt.config.init(
    grunt.util._.extend(
      GruntPathConfig,
      GruntProjectConfig,
      ExpressConfig,
      LessConfig,
      JshintConfig,
      WiredepConfig,
      InjectorConfig,
      WatchConfig,
      CleanConfig,
      CopyConfig,
      ConcatConfig,
      NgAnnotateConfig,
      UglifyConfig,
      CssMinConfig,
      HtmlMinConfig,
      JsDocConfig,
      KarmaConfig

    )
  );

  /**
   * Task Registration
   */
  grunt.registerTask('index', ['wiredep:app', 'injector:app']);
  grunt.registerTask('style', ['less:app']);

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

  grunt.registerTask('build', [
    'style',
    'jshint:app',
    'index'
  ]);

  grunt.registerTask('serve', [
    'build',
    'express:localDevServer',
    'express-keepalive'
  ]);

  grunt.registerTask('dist', [
    'build',

    'clean:temp',
    'clean:dist',
    'copy:dist',
    'concat:dist_css',
    'cssmin:dist',

    'concat:dist_js',
    'ngAnnotate:dist',
    'uglify:dist_app',
    'uglify:dist_bower',
    'clean:temp',

    'injector:dist',
    'wiredep:dist',
    'htmlmin:dist_index',
    'htmlmin:dist_tpl'

  ]);

  grunt.registerTask('serve:dist', [
    'deploy',
    'express:localDistServer',
    'express-keepalive'
  ]);

  grunt.registerTask('serve:docs', [
    'express:localDocsServer',
    'express-keepalive'
  ]);

  grunt.registerTask('docs', [
    'clean:docs',
    'jsdoc:app'
  ]);

  grunt.registerTask('test:unit', [
    'karma:unit'
  ]);

  grunt.registerTask('test:midway', [
    'karma:midway'
  ]);

  //grunt.registerTask('test:e2e', [
  //  'karma:e2e'
  //]);

};
<|endoftext|>