<commit_before>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        'uglify': {
            my_target: {
                files: {
                    'dist/maplace.js': ['src/maplace-versioned.js']
                }
            }
        },
        'string-replace': {
            version: {
                files: {
                    'src/': ['maplace-versioned.js'],
                    './': ['index.html'],
                },
                options: {
                    replacements: [{
                        pattern: /@VERSION/g,
                        replacement: '<%= pkg.version %>'
                    }]
                }
            }
        },
        pkg: grunt.file.readJSON('package.json'),
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-string-replace');

    // Build task.
    grunt.registerTask('default', ['uglify', 'string-replace']);
};
<commit_msg>added watch task, upd string-replace and uglify<commit_after>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        'uglify': {
            my_target: {
                files: {
                    'dist/maplace.min.js': ['dist/maplace.js']
                }
            },
            options: {
                preserveComments: /(?:^!|@(?:license|preserve))/
            }
        },
        'string-replace': {
            version: {
                files: {
                    'dist/maplace.js': ['src/maplace.js'],
                    './index.html': ['index.tpl'],
                },
                options: {
                    replacements: [{
                        pattern: /@VERSION/g,
                        replacement: '<%= pkg.version %>'
                    }]
                }
            }
        },
        'watch': {
            scripts: {
                files: ['*.js', 'src/*.js', 'index.tpl', 'javascripts/*.js', 'stylesheets/*.css'],
                tasks: ['default'],
                options: {
                    spawn: false,
                    debounceDelay: 250
                },
            },
        },
        pkg: grunt.file.readJSON('package.json')
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-string-replace');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // Build task.
    grunt.registerTask('default', ['string-replace', 'uglify']);
};
<|endoftext|>


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

	// Project configuration.
	grunt.initConfig({

		//Read the package.json (optional)
		pkg: grunt.file.readJSON('package.json'),

		// Metadata.
		meta: {
			srcPath: 'src/development/',
			srcPathElementQueries: 'element-queries/element-queries.js',
			deployPath: 'src/'
		},

		banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
			'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
			'* Copyright (c) <%= grunt.template.today("yyyy") %> ',

		// Task configuration.
		uglify: {
			files: {
				src: '<%= meta.deployPath %>rwd-boilerplate.concat.js',  // source files mask
				dest: '<%= meta.deployPath %>',    // destination folder
				expand: true,    // allow dynamic building
				flatten: true,   // remove all unnecessary nesting
				ext: '.min.js'   // replace .js to .min.js
			}
		},

		watch: {
			js:  {
				files: ['<%= meta.srcPath %>*.js', '<%= meta.srcPathElementQueries %>'],
				tasks: ['concat', 'uglify']
			}
		},

		concat: {
			options: {
				stripBanners: true
			},
			dist: {
				src: [
					'<%= meta.srcPath %>utilities.js',
					'<%= meta.srcPathElementQueries %>',
					'<%= meta.srcPath %>rwd-objects.js',
					'<%= meta.srcPath %>rwd-object-slider.js',
					'<%= meta.srcPath %>resize-orientationchange.js',
					'<%= meta.srcPath %>hide-loading.js'
				],
				dest: '<%= meta.deployPath %>rwd-boilerplate.concat.js'
			}
		},

		sass: {
			dist: {
				options: {
					style: 'compressed'
				},
				files: {
					'styles/rwd-boilerplate.css': 'styles/rwd-boilerplate.scss'
				}
			}
		}
	});

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-sass');

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

};<commit_msg>[TASK] Adds sass compiling to grunt watch tasks<commit_after>module.exports = function (grunt) {

	// Project configuration.
	grunt.initConfig({

		//Read the package.json (optional)
		pkg: grunt.file.readJSON('package.json'),

		// Metadata.
		meta: {
			srcPath: 'src/development/',
			srcPathElementQueries: 'element-queries/element-queries.js',
			deployPath: 'src/'
		},

		banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
			'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
			'* Copyright (c) <%= grunt.template.today("yyyy") %> ',

		// Task configuration.
		uglify: {
			files: {
				src: '<%= meta.deployPath %>rwd-boilerplate.concat.js',  // source files mask
				dest: '<%= meta.deployPath %>',    // destination folder
				expand: true,    // allow dynamic building
				flatten: true,   // remove all unnecessary nesting
				ext: '.min.js'   // replace .js to .min.js
			}
		},

		watch: {
			css: {
				files: ['styles/config/project.scss', 'styles/rwd-boilerplate.scss'],
				tasks: ['sass']
			},
			js:  {
				files: ['<%= meta.srcPath %>*.js', '<%= meta.srcPathElementQueries %>'],
				tasks: ['concat', 'uglify']
			}
		},

		concat: {
			options: {
				stripBanners: true
			},
			dist: {
				src: [
					'<%= meta.srcPath %>utilities.js',
					'<%= meta.srcPathElementQueries %>',
					'<%= meta.srcPath %>rwd-objects.js',
					'<%= meta.srcPath %>rwd-object-slider.js',
					'<%= meta.srcPath %>resize-orientationchange.js',
					'<%= meta.srcPath %>hide-loading.js'
				],
				dest: '<%= meta.deployPath %>rwd-boilerplate.concat.js'
			}
		},

		sass: {
			dist: {
				options: {
					style: 'compressed'
				},
				files: {
					'styles/rwd-boilerplate.css': 'styles/rwd-boilerplate.scss'
				}
			}
		}
	});

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-sass');

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

};<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
		minified: {
			files: {
				"dist/dialog.min.js": "dist/dialog.js"
			},
			options: {
				mangle: true,
				compress: true,
				sourceMap: true
			}
		}
    },
	less: {
		gridCore: {
			files: {
				"build/gridCore.css": "src/gridCore.less"
			}
		},
		components: {
			expand: true,
			cwd: "src/components",
			src: "*.less",
			dest: "build/components",
			ext: ".css"
		},
		main: {
			expand: true,
			cwd: "src/",
			src: ["*.less", "!gridCore.less", "!vars.less", "!mixins.less"],
			dest: "build/",
			ext: ".css"
		},
		dist: {
			files: {
				"dist/end2end.css": "end2end.less"
			}
		}
	},
	eslint: {
		end2end: {
			src: ["*.js", "!Gruntfile.js"]
		}
	},
	copy: {
		dist: {
			files: {
				"dist/end2end.js": "end2end.js"
			}
		}
	},
	ngtemplates: {
		end2end: {
			src: "templates/**.html",
			dest: "dist/end2end.js",
			options: {
				htmlmin: {
					collapseWhitespace: true,
					removeComments: true
				},
				append: true
			}
		}
	},
	watch: {
		grunt: {
			files: "Gruntfile.js"
		},
		gridCore: {
			files: "src/gridCore.less",
			tasks: "less:gridCore"
		},
		main: {
			files: "src/*.less",
			tasks: "less:main"
		},
		components: {
			files: "src/components/*.less",
			tasks: "less:components"
		},
		js: {
			files: ["*.js", "templates/*"],
			tasks: "dist-js"
		}
	}
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-angular-templates');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task(s).
  grunt.registerTask('dist', ["less", "dist-js"]);
  grunt.registerTask('dist-js', ["copy", "ngtemplates"]);

};
<commit_msg>Re-indent<commit_after>module.exports = function(grunt) {

	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		uglify: {
			minified: {
				files: {
					"dist/dialog.min.js": "dist/dialog.js"
				},
				options: {
					mangle: true,
					compress: true,
					sourceMap: true
				}
			}
		},
		less: {
			gridCore: {
				files: {
					"build/gridCore.css": "src/gridCore.less"
				}
			},
			components: {
				expand: true,
				cwd: "src/components",
				src: "*.less",
				dest: "build/components",
				ext: ".css"
			},
			main: {
				expand: true,
				cwd: "src/",
				src: ["*.less", "!gridCore.less", "!vars.less", "!mixins.less"],
				dest: "build/",
				ext: ".css"
			},
			dist: {
				files: {
					"dist/end2end.css": "end2end.less"
				}
			}
		},
		eslint: {
			end2end: {
				src: ["*.js", "!Gruntfile.js"]
			}
		},
		copy: {
			dist: {
				files: {
					"dist/end2end.js": "end2end.js"
				}
			}
		},
		ngtemplates: {
			end2end: {
				src: "templates/**.html",
				dest: "dist/end2end.js",
				options: {
					htmlmin: {
						collapseWhitespace: true,
						removeComments: true
					},
					append: true
				}
			}
		},
		watch: {
			grunt: {
				files: "Gruntfile.js"
			},
			gridCore: {
				files: "src/gridCore.less",
				tasks: "less:gridCore"
			},
			main: {
				files: "src/*.less",
				tasks: "less:main"
			},
			components: {
				files: "src/components/*.less",
				tasks: "less:components"
			},
			js: {
				files: ["*.js", "templates/*"],
				tasks: "dist-js"
			}
		},
		clean: {
			grunt
		}
	});

	// Load the plugin that provides the "uglify" task.
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-eslint');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-angular-templates');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');

	// Default task(s).
	grunt.registerTask('dist', ["less", "dist-js"]);
	grunt.registerTask('dist-js', ["copy", "ngtemplates"]);

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

  //--------------------------------------------------------------------------
  // SETUP CONFIG
  //--------------------------------------------------------------------------

  // setup task config
  var config = {

    // Arrays of relevant code classified by type
    files: {
      js: {
        src: [
          'lib/*.js',
          'plugins/**/*.js',
          'test/*.js',
          'bin/kbox.js'
        ]
      }
    },

    clean: {
      coverage: ['coverage']
    },

    shell: {
      // @todo: Maybe remove the .istanbul.yml file and put config here
      testUnit: {command: 'node_modules/istanbul/lib/cli.js  test node_modules/mocha/bin/_mocha'},
      testLarge: {command: 'node_modules/mocha/bin/_mocha --bail test/large'},
      testCoverage: {command: 'node_modules/istanbul/lib/cli.js  cover node_modules/mocha/bin/_mocha'},
      testCheckCoverage: {
        command:
          'node_modules/istanbul/lib/cli.js check-coverage coverage/coverage.json' +
          ' --statements ' + 45 +
          ' --branches ' + 40 +
          ' --functions ' + 45 +
          ' --lines ' + 45
      }
    },

    // This handles automatic version bumping in travis
    bump: {
      options: {
        files: ['package.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json', 'bower.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false
      }
    },

    // Some linting and code standards
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: ['Gruntfile.js', '<%= files.js.src %>']
    },
    jscs: {
      src: ['Gruntfile.js', '<%= files.js.src %>'],
      options: {
        config: '.jscsrc'
      }
    },
    jsdoc: {
      target: {
        src: ['lib/**/*.js'],
        options: {
          destination: 'doc'
        }
      }
    },

    watch: {
      // bcauldwell: I'm just using this to make developing unit tests easier.
      unit: {
        files: ['**/*.js'],
        tasks: ['unit']
      }
    }

  };

  //--------------------------------------------------------------------------
  // LOAD TASKS
  //--------------------------------------------------------------------------

  // load task config
  grunt.initConfig(config);

  // load external tasks
  //grunt.loadTasks('tasks');

  // load grunt-* tasks from package.json dependencies
  require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);

  //--------------------------------------------------------------------------
  // SETUP WORKFLOWS
  //--------------------------------------------------------------------------

  // unit testing
  grunt.registerTask('unit', [
    'shell:testUnit'
  ]);

  // testing code coverage
  grunt.registerTask('coverage', [
    'clean:coverage',
    'shell:testCoverage',
    'shell:testCheckCoverage'
  ]);

  grunt.registerTask('bump-patch', [
    'bump-only:patch'
  ]);

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

  // large functional testing
  grunt.registerTask('test:large', [
    'shell:test_large'
  ]);

  grunt.registerTask('test:code', [
    'jshint',
    'jscs'
  ]);

};
<commit_msg>Check many levels for things<commit_after>'use strict';

module.exports = function(grunt) {

  //--------------------------------------------------------------------------
  // SETUP CONFIG
  //--------------------------------------------------------------------------

  // setup task config
  var config = {

    // Arrays of relevant code classified by type
    files: {
      js: {
        src: [
          'lib/**/*.js',
          'plugins/**/*.js',
          'test/*.js',
          'bin/kbox.js'
        ]
      }
    },

    clean: {
      coverage: ['coverage']
    },

    shell: {
      // @todo: Maybe remove the .istanbul.yml file and put config here
      testUnit: {command: 'node_modules/istanbul/lib/cli.js  test node_modules/mocha/bin/_mocha'},
      testLarge: {command: 'node_modules/mocha/bin/_mocha --bail test/large'},
      testCoverage: {command: 'node_modules/istanbul/lib/cli.js  cover node_modules/mocha/bin/_mocha'},
      testCheckCoverage: {
        command:
          'node_modules/istanbul/lib/cli.js check-coverage coverage/coverage.json' +
          ' --statements ' + 45 +
          ' --branches ' + 40 +
          ' --functions ' + 45 +
          ' --lines ' + 45
      }
    },

    // This handles automatic version bumping in travis
    bump: {
      options: {
        files: ['package.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json', 'bower.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false
      }
    },

    // Some linting and code standards
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: ['Gruntfile.js', '<%= files.js.src %>']
    },
    jscs: {
      src: ['Gruntfile.js', '<%= files.js.src %>'],
      options: {
        config: '.jscsrc'
      }
    },
    jsdoc: {
      target: {
        src: ['lib/**/*.js'],
        options: {
          destination: 'doc'
        }
      }
    },

    watch: {
      // bcauldwell: I'm just using this to make developing unit tests easier.
      unit: {
        files: ['**/*.js'],
        tasks: ['unit']
      }
    }

  };

  //--------------------------------------------------------------------------
  // LOAD TASKS
  //--------------------------------------------------------------------------

  // load task config
  grunt.initConfig(config);

  // load external tasks
  //grunt.loadTasks('tasks');

  // load grunt-* tasks from package.json dependencies
  require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);

  //--------------------------------------------------------------------------
  // SETUP WORKFLOWS
  //--------------------------------------------------------------------------

  // unit testing
  grunt.registerTask('unit', [
    'shell:testUnit'
  ]);

  // testing code coverage
  grunt.registerTask('coverage', [
    'clean:coverage',
    'shell:testCoverage',
    'shell:testCheckCoverage'
  ]);

  grunt.registerTask('bump-patch', [
    'bump-only:patch'
  ]);

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

  // large functional testing
  grunt.registerTask('test:large', [
    'shell:test_large'
  ]);

  grunt.registerTask('test:code', [
    'jshint',
    'jscs'
  ]);

};
<|endoftext|>


<commit_before>// To use this, first run these commands:
// npm install -g grunt-cli
// npm install grunt --save-dev
// npm install grunt-contrib-clean --save-dev
// npm install grunt-traceur-simple --save-dev
module.exports = function (grunt) {
  grunt.initConfig({
    clean: ['dist'],
    traceur: {
      options: {
        // This option includes runtime code in the generated file.
        //includeRuntime: true,
        traceurOptions: '--experimental --sourcemap'
      },
      all: {
        files: {
          // Just need to transpile main file if it imports others.
          'dist/demo.js': ['src/demo.js']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-traceur-simple');
  grunt.registerTask('default', ['traceur']);
};
<commit_msg>fixed Grunt sourcemap generation<commit_after>// To use this, first run these commands:
// npm install -g grunt-cli
// npm install grunt --save-dev
// npm install grunt-contrib-clean --save-dev
// npm install grunt-traceur-simple --save-dev
module.exports = function (grunt) {
  grunt.initConfig({
    clean: ['dist'],
    traceur: {
      options: {
        // This option includes runtime code in the generated file.
        //includeRuntime: true,
        traceurOptions: '--experimental --source-maps'
      },
      all: {
        files: {
          // Just need to transpile main file if it imports others.
          'dist/demo.js': ['src/demo.js']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-traceur-simple');
  grunt.registerTask('default', ['traceur']);
};
<|endoftext|>


<commit_before>/**
 * PowerTip Grunt Config
 */

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

	// include grunt enhancements
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt);

	// configure grunt
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		buildpath: 'dist',
		temppath: '<%= buildpath %>/temp',
		files: {
			cat: 'jquery.powertip.js',
			min: 'jquery.powertip.min.js',
			zip: 'jquery.powertip-<%= pkg.version %>.zip',
			license: 'LICENSE.txt',
			changelog: 'CHANGELOG.yml'
		},
		banner: [
			'/*!',
			' <%= pkg.title %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)',
			' <%= pkg.homepage %>',
			' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).',
			' Released under <%= pkg.license %> license.',
			' https://raw.github.com/stevenbenner/jquery-powertip/master/<%= files.license %>',
			'*/\n'
		].join('\n'),
		clean: {
			dist: [ '<%= buildpath %>' ],
			temp: [ '<%= temppath %>' ]
		},
		jshint: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					jshintrc: '.jshintrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					jshintrc: 'test/.jshintrc'
				}
			},
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				options: {
					jshintrc: 'src/.jshintrc'
				}
			}
		},
		jscs: {
			options: {
				config: '.jscsrc'
			},
			grunt: {
				src: [ 'Gruntfile.js' ]
			},
			tests: {
				src: [ 'test/**/*.js' ]
			},
			js: {
				src: [ 'src/*.js' ]
			}
		},
		jsonlint: {
			project: {
				src: [
					'package.json',
					'.jscsrc',
					'.jshintrc',
					'{src,test}/.jshintrc'
				]
			}
		},
		concat: {
			options: {
				stripBanners: true
			},
			core: {
				src: [
					'src/core.js',
					'src/csscoordinates.js',
					'src/displaycontroller.js',
					'src/placementcalculator.js',
					'src/tooltipcontroller.js',
					'src/utility.js'
				],
				dest: '<%= temppath %>/core.js',
				nonull: true
			},
			dist: {
				src: [
					'src/intro.js',
					'<%= concat.core.dest %>',
					'src/outro.js'
				],
				dest: '<%= buildpath %>/<%= files.cat %>',
				options: {
					banner: '<%= banner %>'
				},
				nonull: true
			}
		},
		indent: {
			js: {
				src: [ '<%= concat.core.dest %>' ],
				dest: '<%= concat.core.dest %>',
				options: {
					change: 1
				}
			}
		},
		browserify: {
			test: {
				src: [ 'test/browserify.js' ],
				dest: '<%= temppath %>/bundle.js'
			}
		},
		qunit: {
			tests: [
				'test/index.html',
				'test/amd.html'
			],
			browserify: [ '<%= copy.browserify.dest %>' ]
		},
		uglify: {
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: '<%= buildpath %>/<%= files.min %>',
				options: {
					banner: '<%= banner %>',
					report: 'gzip',
					screwIE8: false
				}
			}
		},
		copy: {
			css: {
				src: [ 'css/*.css' ],
				dest: '<%= buildpath %>/'
			},
			examples: {
				src: [ 'examples/*' ],
				dest: '<%= buildpath %>/',
				options: {
					process: function(content) {
						var scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
							builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
						return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
					}
				}
			},
			browserify: {
				src: [ 'test/browserify.html' ],
				dest: '<%= temppath %>/browserify.html',
				nonull: true
			},
			license: {
				src: [ '<%= files.license %>' ],
				dest: '<%= buildpath %>/<%= files.license %>',
				nonull: true
			},
			changelog: {
				src: [ '<%= files.changelog %>' ],
				dest: '<%= buildpath %>/<%= files.changelog %>',
				nonull: true
			},
			index: {
				src: [ '<%= buildpath %>/index.md' ],
				dest: 'index.md',
				nonull: true
			},
			jsassets: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: 'scripts/<%= files.cat %>',
				nonull: true
			},
			cssassets: {
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/css/',
						src: [ '*.css', '!*.min.css' ],
						dest: 'styles/'
					}
				]
			}
		},
		csslint: {
			themes: {
				src: [ 'css/*.css' ],
				options: {
					ids: false
				}
			}
		},
		cssmin: {
			compress: {
				files: [
					{
						expand: true,
						cwd: 'css/',
						src: [ '*.css' ],
						dest: '<%= buildpath %>/css/',
						rename: function(dest, matchedSrcPath) {
							return dest + matchedSrcPath.replace('.css', '.min.css');
						}
					}
				],
				options: {
					report: 'gzip'
				}
			}
		},
		compress: {
			zip: {
				options: {
					archive: '<%= buildpath %>/<%= files.zip %>'
				},
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/',
						src: [ '**/*' ]
					}
				]
			}
		},
		shell: {
			checkoutpages: {
				command: 'git checkout gh-pages'
			},
			addindex: {
				command: [
					'git add index.md',
					'git commit -m "Publishing docs"'
				].join(' && ')
			},
			addassets: {
				command: [
					'git add scripts/<%= files.cat %>',
					'git add styles/jquery.powertip*.css',
					'git commit -m "Publishing assets"'
				].join(' && ')
			},
			checkoutmaster: {
				command: 'git checkout master'
			}
		}
	});

	// custom task to build the gh-pages index.md file
	grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', function() {
		var template = grunt.file.read('doc/gh-pages.template.md'),
			data = {
				pkg: grunt.file.readJSON('package.json'),
				doc: grunt.file.read('doc/README.md'),
				changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
			},
			page = grunt.template.process(template, { data: data });
		grunt.file.write('dist/index.md', page);
		grunt.log.ok('gh-pages markdown created');
	});

	// force unix style line endings
	grunt.util.linefeed = '\n';

	// register grunt tasks
	grunt.registerTask('default', [ 'test' ]);
	grunt.registerTask('test', [ 'jsonlint', 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'csslint', 'clean:temp' ]);
	grunt.registerTask('test:browserify', [ 'copy:browserify', 'browserify', 'qunit:browserify' ]);
	grunt.registerTask('build', [ 'jsonlint', 'build:js', 'build:css' ]);
	grunt.registerTask('build:js', [ 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'uglify', 'clean:temp' ]);
	grunt.registerTask('build:css', [ 'csslint', 'copy:css', 'cssmin' ]);
	grunt.registerTask('build:docs', [ 'copy:examples', 'copy:license', 'copy:changelog' ]);
	grunt.registerTask('build:release', [ 'clean:dist', 'build', 'build:docs', 'compress' ]);
	grunt.registerTask('build:npm', [ 'clean:dist', 'build' ]);
	grunt.registerTask('travis', [ 'test' ]);
	grunt.registerTask('deploy:docs', [ 'build:gh-pages', 'shell:checkoutpages', 'copy:index', 'shell:addindex', 'shell:checkoutmaster' ]);
	grunt.registerTask('deploy:assets', [ 'build:release', 'shell:checkoutpages', 'copy:jsassets', 'copy:cssassets', 'shell:addassets', 'shell:checkoutmaster' ]);
};
<commit_msg>Added 'order-alphabetical' to CSSLint ignore override<commit_after>/**
 * PowerTip Grunt Config
 */

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

	// include grunt enhancements
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt);

	// configure grunt
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		buildpath: 'dist',
		temppath: '<%= buildpath %>/temp',
		files: {
			cat: 'jquery.powertip.js',
			min: 'jquery.powertip.min.js',
			zip: 'jquery.powertip-<%= pkg.version %>.zip',
			license: 'LICENSE.txt',
			changelog: 'CHANGELOG.yml'
		},
		banner: [
			'/*!',
			' <%= pkg.title %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)',
			' <%= pkg.homepage %>',
			' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).',
			' Released under <%= pkg.license %> license.',
			' https://raw.github.com/stevenbenner/jquery-powertip/master/<%= files.license %>',
			'*/\n'
		].join('\n'),
		clean: {
			dist: [ '<%= buildpath %>' ],
			temp: [ '<%= temppath %>' ]
		},
		jshint: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					jshintrc: '.jshintrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					jshintrc: 'test/.jshintrc'
				}
			},
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				options: {
					jshintrc: 'src/.jshintrc'
				}
			}
		},
		jscs: {
			options: {
				config: '.jscsrc'
			},
			grunt: {
				src: [ 'Gruntfile.js' ]
			},
			tests: {
				src: [ 'test/**/*.js' ]
			},
			js: {
				src: [ 'src/*.js' ]
			}
		},
		jsonlint: {
			project: {
				src: [
					'package.json',
					'.jscsrc',
					'.jshintrc',
					'{src,test}/.jshintrc'
				]
			}
		},
		concat: {
			options: {
				stripBanners: true
			},
			core: {
				src: [
					'src/core.js',
					'src/csscoordinates.js',
					'src/displaycontroller.js',
					'src/placementcalculator.js',
					'src/tooltipcontroller.js',
					'src/utility.js'
				],
				dest: '<%= temppath %>/core.js',
				nonull: true
			},
			dist: {
				src: [
					'src/intro.js',
					'<%= concat.core.dest %>',
					'src/outro.js'
				],
				dest: '<%= buildpath %>/<%= files.cat %>',
				options: {
					banner: '<%= banner %>'
				},
				nonull: true
			}
		},
		indent: {
			js: {
				src: [ '<%= concat.core.dest %>' ],
				dest: '<%= concat.core.dest %>',
				options: {
					change: 1
				}
			}
		},
		browserify: {
			test: {
				src: [ 'test/browserify.js' ],
				dest: '<%= temppath %>/bundle.js'
			}
		},
		qunit: {
			tests: [
				'test/index.html',
				'test/amd.html'
			],
			browserify: [ '<%= copy.browserify.dest %>' ]
		},
		uglify: {
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: '<%= buildpath %>/<%= files.min %>',
				options: {
					banner: '<%= banner %>',
					report: 'gzip',
					screwIE8: false
				}
			}
		},
		copy: {
			css: {
				src: [ 'css/*.css' ],
				dest: '<%= buildpath %>/'
			},
			examples: {
				src: [ 'examples/*' ],
				dest: '<%= buildpath %>/',
				options: {
					process: function(content) {
						var scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
							builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
						return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
					}
				}
			},
			browserify: {
				src: [ 'test/browserify.html' ],
				dest: '<%= temppath %>/browserify.html',
				nonull: true
			},
			license: {
				src: [ '<%= files.license %>' ],
				dest: '<%= buildpath %>/<%= files.license %>',
				nonull: true
			},
			changelog: {
				src: [ '<%= files.changelog %>' ],
				dest: '<%= buildpath %>/<%= files.changelog %>',
				nonull: true
			},
			index: {
				src: [ '<%= buildpath %>/index.md' ],
				dest: 'index.md',
				nonull: true
			},
			jsassets: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: 'scripts/<%= files.cat %>',
				nonull: true
			},
			cssassets: {
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/css/',
						src: [ '*.css', '!*.min.css' ],
						dest: 'styles/'
					}
				]
			}
		},
		csslint: {
			themes: {
				src: [ 'css/*.css' ],
				options: {
					ids: false,
					'order-alphabetical': false
				}
			}
		},
		cssmin: {
			compress: {
				files: [
					{
						expand: true,
						cwd: 'css/',
						src: [ '*.css' ],
						dest: '<%= buildpath %>/css/',
						rename: function(dest, matchedSrcPath) {
							return dest + matchedSrcPath.replace('.css', '.min.css');
						}
					}
				],
				options: {
					report: 'gzip'
				}
			}
		},
		compress: {
			zip: {
				options: {
					archive: '<%= buildpath %>/<%= files.zip %>'
				},
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/',
						src: [ '**/*' ]
					}
				]
			}
		},
		shell: {
			checkoutpages: {
				command: 'git checkout gh-pages'
			},
			addindex: {
				command: [
					'git add index.md',
					'git commit -m "Publishing docs"'
				].join(' && ')
			},
			addassets: {
				command: [
					'git add scripts/<%= files.cat %>',
					'git add styles/jquery.powertip*.css',
					'git commit -m "Publishing assets"'
				].join(' && ')
			},
			checkoutmaster: {
				command: 'git checkout master'
			}
		}
	});

	// custom task to build the gh-pages index.md file
	grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', function() {
		var template = grunt.file.read('doc/gh-pages.template.md'),
			data = {
				pkg: grunt.file.readJSON('package.json'),
				doc: grunt.file.read('doc/README.md'),
				changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
			},
			page = grunt.template.process(template, { data: data });
		grunt.file.write('dist/index.md', page);
		grunt.log.ok('gh-pages markdown created');
	});

	// force unix style line endings
	grunt.util.linefeed = '\n';

	// register grunt tasks
	grunt.registerTask('default', [ 'test' ]);
	grunt.registerTask('test', [ 'jsonlint', 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'csslint', 'clean:temp' ]);
	grunt.registerTask('test:browserify', [ 'copy:browserify', 'browserify', 'qunit:browserify' ]);
	grunt.registerTask('build', [ 'jsonlint', 'build:js', 'build:css' ]);
	grunt.registerTask('build:js', [ 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'uglify', 'clean:temp' ]);
	grunt.registerTask('build:css', [ 'csslint', 'copy:css', 'cssmin' ]);
	grunt.registerTask('build:docs', [ 'copy:examples', 'copy:license', 'copy:changelog' ]);
	grunt.registerTask('build:release', [ 'clean:dist', 'build', 'build:docs', 'compress' ]);
	grunt.registerTask('build:npm', [ 'clean:dist', 'build' ]);
	grunt.registerTask('travis', [ 'test' ]);
	grunt.registerTask('deploy:docs', [ 'build:gh-pages', 'shell:checkoutpages', 'copy:index', 'shell:addindex', 'shell:checkoutmaster' ]);
	grunt.registerTask('deploy:assets', [ 'build:release', 'shell:checkoutpages', 'copy:jsassets', 'copy:cssassets', 'shell:addassets', 'shell:checkoutmaster' ]);
};
<|endoftext|>


<commit_before>/*
 * grunt-mxmlc
 * https://github.com/JamesMGreene/grunt-mxmlc
 *
 * Copyright (c) 2013 James M. Greene
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'tasks/**/*.js',
        '<%= nodeunit.tests %>'
      ]
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tests: ['tmp']
    },

    // Configuration to be run (and then tested).
    mxmlc: {
      options: {
        rawConfig: '+configname=air'
      },
      testCompileSuccess: {
        src: ['test/testData/testApp.as'],
        dest: 'tmp/testApp.swf'
      },
      testCompileFailureDueToSynaxError: {
        options: {
          // `force: true` is required to not fail the Grunt run (as we KNOW this one should cause an error)
          force: true
        },
        src: ['test/testData/errorApp.as'],
        dest: 'tmp/errorApp.swf'
      }
    },

    // Unit tests.
    nodeunit: {
      tests: ['test/**/*_test.js']
    }

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-clean');

  // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  // plugin's task(s), then test the result.
  grunt.registerTask('test', ['clean', 'compc', 'nodeunit', 'clean']);

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint', 'test']);
  grunt.registerTask('travis', ['jshint', 'test']);

};
<commit_msg>Update copyright<commit_after>/*
 * grunt-mxmlc
 * https://github.com/JamesMGreene/grunt-mxmlc
 *
 * Copyright (c) 2015 James M. Greene, contributors
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'tasks/**/*.js',
        '<%= nodeunit.tests %>'
      ]
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tests: ['tmp']
    },

    // Configuration to be run (and then tested).
    mxmlc: {
      options: {
        rawConfig: '+configname=air'
      },
      testCompileSuccess: {
        src: ['test/testData/testApp.as'],
        dest: 'tmp/testApp.swf'
      },
      testCompileFailureDueToSynaxError: {
        options: {
          // `force: true` is required to not fail the Grunt run (as we KNOW this one should cause an error)
          force: true
        },
        src: ['test/testData/errorApp.as'],
        dest: 'tmp/errorApp.swf'
      }
    },

    // Unit tests.
    nodeunit: {
      tests: ['test/**/*_test.js']
    }

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-clean');

  // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  // plugin's task(s), then test the result.
  grunt.registerTask('test', ['clean', 'compc', 'nodeunit', 'clean']);

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint', 'test']);
  grunt.registerTask('travis', ['jshint', 'test']);

};
<|endoftext|>


<commit_before>/**
* CONFIDENTIAL
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
* This is unpublished proprietary source code of Red Hat.
**/
// Generated on 2014-03-05 using generator-angular 0.7.1
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    app: {
      // configurable paths
      src: 'src',
      dist: 'www',
      url: '',
      default_local_server_url: 'http://localhost:8001'
    },

    copy: {
      static: {
        files: [
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.html'], dest: '<%= app.dist %>', filter: 'isFile'},
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.json'], dest: '<%= app.dist %>', filter: 'isFile'},
        ],
      },
      css: {
        files: [
          {cwd: 'node_modules/', src: ['angular-material/angular-material.css', 'patternfly/dist/css/patternfly.css', 'c3/c3.css'], dest: '<%= app.dist %>/css/', expand: true, flatten: true },
          {cwd: 'node_modules/patternfly/dist/', src: 'fonts/**/*.*', dest: '<%= app.dist %>/', expand: true },
        ]
      }
    },

    sass: {
        options: {
            sourceMap: true
        },
        dist: {
            files: {
                '<%= app.dist %>/css/portal.css': '<%= app.src %>/sass/portal.scss'
            }
        }
    },

    browserify: {
      options: {
        browserifyOptions: {
           debug: true
        }
      },
      all: {
        files: {
          "<%= app.dist %>/app/bundle.js": ["<%= app.src %>/app/main.js"]
        },
        options: {
          watch: true
        }
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= app.dist %>/app/bundle.js'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      html: {
        files: ['<%= app.src %>/**/*.html'],
        tasks: ['copy:static']
      },
      sass: {
        files: ['**/*.scss'],
        tasks: ['sass']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= app.dist %>/**/*.html',
          '<%= app.dist %>/css/{,*/}*.css',
          '<%= app.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9003,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35731
      },
      livereload: {
        options: {
          open: {
            target: '<%= app.url %>'
          },
          base: [
            '.tmp',
            '<%= app.dist %>'
          ]
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: ['<%= app.dist %>'],
      server: '.tmp'
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'local') {
      var conn = 'http://' + grunt.config.get('connect.options.hostname') + ':' +
        grunt.config.get('connect.options.port');
      var url = grunt.option('url') || grunt.config.get('app.default_local_server_url');
      grunt.config.set('app.url', conn + '/?url=' + url);
    } else {
      // open with no url passed to fh-js-sdk
      grunt.config.set('connect.livereload.options.open', true);
    }

    grunt.task.run([
      'clean:dist',
      'sass',
      'copy',
      'clean:server',
      'browserify',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('default', ['serve']);
};
<commit_msg>Further fixes to the js watch task<commit_after>/**
* CONFIDENTIAL
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
* This is unpublished proprietary source code of Red Hat.
**/
// Generated on 2014-03-05 using generator-angular 0.7.1
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    app: {
      // configurable paths
      src: 'src',
      dist: 'www',
      url: '',
      default_local_server_url: 'http://localhost:8001'
    },

    copy: {
      static: {
        files: [
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.html'], dest: '<%= app.dist %>', filter: 'isFile'},
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.json'], dest: '<%= app.dist %>', filter: 'isFile'},
        ],
      },
      css: {
        files: [
          {cwd: 'node_modules/', src: ['angular-material/angular-material.css', 'patternfly/dist/css/patternfly.css', 'c3/c3.css'], dest: '<%= app.dist %>/css/', expand: true, flatten: true },
          {cwd: 'node_modules/patternfly/dist/', src: 'fonts/**/*.*', dest: '<%= app.dist %>/', expand: true },
        ]
      }
    },

    sass: {
        options: {
            sourceMap: true
        },
        dist: {
            files: {
                '<%= app.dist %>/css/portal.css': '<%= app.src %>/sass/portal.scss'
            }
        }
    },

    browserify: {
      options: {
        browserifyOptions: {
           debug: true
        }
      },
      all: {
        files: {
          "<%= app.dist %>/app/bundle.js": ["<%= app.src %>/app/main.js"]
        },
        options: {
          watch: true
        }
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
<<<<<<< HEAD
        files: ['<%= app.dist %>/app/bundle.js'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      html: {
        files: ['<%= app.src %>/**/*.html'],
        tasks: ['copy:static']
      },
      sass: {
        files: ['**/*.scss'],
        tasks: ['sass']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= app.dist %>/**/*.html',
          '<%= app.dist %>/css/{,*/}*.css',
          '<%= app.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9003,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35731
      },
      livereload: {
        options: {
          open: {
            target: '<%= app.url %>'
          },
          base: [
            '.tmp',
            '<%= app.dist %>'
          ]
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: ['<%= app.dist %>'],
      server: '.tmp'
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'local') {
      var conn = 'http://' + grunt.config.get('connect.options.hostname') + ':' +
        grunt.config.get('connect.options.port');
      var url = grunt.option('url') || grunt.config.get('app.default_local_server_url');
      grunt.config.set('app.url', conn + '/?url=' + url);
    } else {
      // open with no url passed to fh-js-sdk
      grunt.config.set('connect.livereload.options.open', true);
    }

    grunt.task.run([
      'clean:dist',
      'sass',
      'copy',
      'clean:server',
      'browserify',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('default', ['serve']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  require('jit-grunt')(grunt, {
    useminPrepare: 'grunt-usemin',
    removelogging: 'grunt-remove-logging',
  });

  grunt.initConfig({
    packageFile: grunt.file.readJSON('package.json'),
    manifestFile: grunt.file.readJSON('src/manifest.json'),
    jsonldFile: grunt.file.read('src/json-ld.json'),
    modernizrFile: grunt.file.read('src/js/vendor/modernizr-custom.js'),

    watch: {
      sass: {
        options: {
          debounceDelay: 250,
        },
        files: 'src/sass/**',
        tasks: ['growl', 'sass', 'autoprefixer'],
      },
      manifest: {
        options: {
          debounceDelay: 250,
        },
        files: ['src/index.html', 'src/css/**', 'src/js/**', 'src/img/**', 'src/sounds/**'],
        tasks: ['growl', 'manifest:src'],
      },
    },

    growl: {
      watch: {
        title: 'Grunt',
        message: 'Updating…',
      },
    },

    sass: {
      src: {
        options: {
          style: 'expanded',
        },
        files: {
          'src/css/styles.css': 'src/sass/styles.scss',
        },
      },
    },

    autoprefixer: {
      options: {
        browsers: ['> 1%', 'last 2 versions', 'android >= 2'],
      },
      no_dest: {
        src: 'src/css/**/*.css',
      },
    },

    clean: {
      build: {
        src: 'build/',
      },
    },

    copy: {
      build: {
        files: [
          {
            expand: true,
            cwd: 'src/',
            src: [
              'index.html',
              '404.html',
              '.htaccess',
              '.well-known/*',
              'manifest.webapp',
              'config.xml',
              'css/font/*',
              'img/*',
              'sounds/*',
              'js/vendor/analytics.js',
              'js/vendor/SVGEventListener-0.2.3.js',
              'wow/*',
              "manifest.webmanifest",
            ],
            dest: 'build/',
          },
        ],
      },
      manifest: {
        files: [
          {
            expand: true,
            cwd: 'src/',
            src: [
              'manifest.json',
            ],
            dest: 'build/',
          },
        ],
      },
    },

    useminPrepare: {
      options: {
        dest: 'build/',
      },
      html: 'src/index.html',
    },
    usemin: {
      html: 'build/index.html',
    },

    concat: {
      options: {
        separator: ';',
      },
    },

    removelogging: {
      build: {
        src: 'build/js/app.js',
        options: {},
      },
    },

    uglify: {
      options: {
        banner: "/*! <%= packageFile.name %> v<%= packageFile.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */",
        report:'min',
      },
    },

    cssmin: {
      options: {
        banner: "/*! <%= packageFile.name %> v<%= packageFile.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */",
      },
    },

    rev: {
      options: {
        encoding: 'utf8',
        algorithm: 'md5',
        length: 8,
      },
      assets: {
        files: [
          {
            src: [
              'build/css/styles.css',
              'build/js/app.js',
            ],
          },
        ],
      },
    },

    manifest: {
      src: {
        options: {
          basePath: 'src/',
          network: ['*'],
          verbose: true,
          timestamp: true,
        },
        src: [
          'js/**/*.js',
          'css/styles.css',
          'css/font/*',
        ],
        dest: 'src/manifest.appcache',
      },
      build: {
        options: {
          basePath: 'build/',
          network: ['*'],
          verbose: true,
          timestamp: true,
        },
        src: [
          'js/*.js',
          'css/*.css',
          'css/font/*',
        ],
        dest: 'build/manifest.appcache',
      },
    },

    realFavicon: {
      favicons: {
        src: './src/img/esviji-logo.png',
        dest: './build/',
        options: {
          iconsPath: '/',
          html: ['./build/index.html'],
          design: {
            ios: {
              pictureAspect: 'backgroundAndMargin',
              backgroundColor: '#cccccc',
              margin: '14%',
              appName: 'esviji',
            },
            desktopBrowser: {},
            windows: {
              appName: 'esviji',
              pictureAspect: 'noChange',
              backgroundColor: '#00aba9',
              onConflict: 'keep_existing',
            },
            androidChrome: {
              pictureAspect: 'shadow',
              themeColor: '#444444',
              manifest: {
                name: 'esviji',
                startUrl: 'https://play.esviji.com',
                display: 'standalone',
                orientation: 'notSet',
                existingManifest: '<%= manifestFile %>',
                onConflict: 'keep_existing',
              },
            },
            safariPinnedTab: {
              pictureAspect: 'silhouette',
              themeColor: '#444444',
            },
          },
          settings: {
            compression: 1,
            scalingAlgorithm: 'Mitchell',
            errorOnImageTooSmall: false,
          },
        },
      },
    },

    sed: {
      version: {
        path: 'build/',
        recursive: true,
        pattern: '%VERSION%',
        replacement: '<%= packageFile.version %>',
      },
      title: {
        path: 'build/',
        recursive: true,
        pattern: '%TITLE%',
        replacement: '<%= packageFile.title %>',
      },
      description: {
        path: 'build/',
        recursive: true,
        pattern: '%DESCRIPTION%',
        replacement: '<%= packageFile.description %>',
      },
      jsonld: {
        path: 'build/',
        recursive: true,
        pattern: '%JSONLD%',
        replacement: '<%= jsonldFile %>',
      },
      inlinemodernizr: {
        path: 'build/',
        recursive: true,
        pattern: '%MODERNIZR%',
        replacement: '<%= modernizrFile %>',
      },
      // https://github.com/RealFaviconGenerator/realfavicongenerator/issues/207
      cleanManifestFilePaths: {
        pattern: '\\\\/',
        replacement: '/',
      },
        path: "build/manifest.webapp",
    },

    devUpdate: {
      main: {
        options: {
          updateType: 'prompt',
          semver: false,
        },
      },
    },

  });

  grunt.registerTask('default', ['compile', 'watch']);
  grunt.registerTask('compile', ['growl', 'sass', 'autoprefixer', 'manifest:src']);
  grunt.registerTask('build', ['sass', 'autoprefixer', 'clean', 'copy:build', 'useminPrepare', 'concat', 'removelogging', 'uglify', 'cssmin', 'rev', 'usemin', 'realFavicon', 'sed', 'manifest:build']);
  grunt.registerTask('up', ['devUpdate']);
};
<commit_msg>Prettier<commit_after>module.exports = function(grunt) {
  require("jit-grunt")(grunt, {
    useminPrepare: "grunt-usemin",
    removelogging: "grunt-remove-logging"
  });

  grunt.initConfig({
    packageFile: grunt.file.readJSON("package.json"),
    manifestFile: grunt.file.readJSON("src/manifest.webmanifest"),
    jsonldFile: grunt.file.read("src/json-ld.json"),
    modernizrFile: grunt.file.read("src/js/vendor/modernizr-custom.js"),

    watch: {
      sass: {
        options: {
          debounceDelay: 250
        },
        files: "src/sass/**",
        tasks: ["growl", "sass", "autoprefixer"]
      },
      manifest: {
        options: {
          debounceDelay: 250
        },
        files: [
          "src/index.html",
          "src/css/**",
          "src/js/**",
          "src/img/**",
          "src/sounds/**"
        ],
        tasks: ["growl", "manifest:src"]
      }
    },

    growl: {
      watch: {
        title: "Grunt",
        message: "Updating…"
      }
    },

    sass: {
      src: {
        options: {
          style: "expanded"
        },
        files: {
          "src/css/styles.css": "src/sass/styles.scss"
        }
      }
    },

    autoprefixer: {
      options: {
        browsers: ["> 1%", "last 2 versions", "android >= 2"]
      },
      no_dest: {
        src: "src/css/**/*.css"
      }
    },

    clean: {
      build: {
        src: "build/"
      }
    },

    copy: {
      build: {
        files: [
          {
            expand: true,
            cwd: "src/",
            src: [
              "index.html",
              "404.html",
              ".htaccess",
              ".well-known/*",
              "manifest.webapp",
              "manifest.webmanifest",
              "config.xml",
              "css/font/*",
              "img/*",
              "sounds/*",
              "js/vendor/analytics.js",
              "js/vendor/SVGEventListener-0.2.3.js",
              "wow/*"
            ],
            dest: "build/"
          }
        ]
      },
      manifest: {
        files: [
          {
            expand: true,
            cwd: "src/",
            src: ["manifest.json"],
            dest: "build/"
          }
        ]
      }
    },

    useminPrepare: {
      options: {
        dest: "build/"
      },
      html: "src/index.html"
    },
    usemin: {
      html: "build/index.html"
    },

    concat: {
      options: {
        separator: ";"
      }
    },

    removelogging: {
      build: {
        src: "build/js/app.js",
        options: {}
      }
    },

    uglify: {
      options: {
        banner:
          "/*! <%= packageFile.name %> v<%= packageFile.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */",
        report: "min"
      }
    },

    cssmin: {
      options: {
        banner:
          "/*! <%= packageFile.name %> v<%= packageFile.version %> - <%= grunt.template.today('yyyy-mm-dd') %> - Copyright (c) 1992-<%= grunt.template.today('yyyy') %> Nicolas Hoizey <nicolas@hoizey.com> */"
      }
    },

    rev: {
      options: {
        encoding: "utf8",
        algorithm: "md5",
        length: 8
      },
      assets: {
        files: [
          {
            src: ["build/css/styles.css", "build/js/app.js"]
          }
        ]
      }
    },

    manifest: {
      src: {
        options: {
          basePath: "src/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: ["js/**/*.js", "css/styles.css", "css/font/*"],
        dest: "src/manifest.appcache"
      },
      build: {
        options: {
          basePath: "build/",
          network: ["*"],
          verbose: true,
          timestamp: true
        },
        src: ["js/*.js", "css/*.css", "css/font/*"],
        dest: "build/manifest.appcache"
      }
    },

    realFavicon: {
      favicons: {
        src: "./src/img/esviji-logo.png",
        dest: "./build/",
        options: {
          iconsPath: "/",
          html: ["./build/index.html"],
          design: {
            ios: {
              pictureAspect: "backgroundAndMargin",
              backgroundColor: "#cccccc",
              margin: "14%",
              appName: "esviji"
            },
            desktopBrowser: {},
            windows: {
              appName: "esviji",
              pictureAspect: "noChange",
              backgroundColor: "#00aba9",
              onConflict: "keep_existing"
            },
            androidChrome: {
              pictureAspect: "shadow",
              themeColor: "#444444",
              manifest: {
                name: "esviji",
                startUrl: "https://play.esviji.com",
                display: "standalone",
                orientation: "notSet",
                existingManifest: "<%= manifestFile %>",
                onConflict: "keep_existing"
              }
            },
            safariPinnedTab: {
              pictureAspect: "silhouette",
              themeColor: "#444444"
            }
          },
          settings: {
            compression: 1,
            scalingAlgorithm: "Mitchell",
            errorOnImageTooSmall: false
          }
        }
      }
    },

    sed: {
      version: {
        path: "build/",
        recursive: true,
        pattern: "%VERSION%",
        replacement: "<%= packageFile.version %>"
      },
      title: {
        path: "build/",
        recursive: true,
        pattern: "%TITLE%",
        replacement: "<%= packageFile.title %>"
      },
      description: {
        path: "build/",
        recursive: true,
        pattern: "%DESCRIPTION%",
        replacement: "<%= packageFile.description %>"
      },
      jsonld: {
        path: "build/",
        recursive: true,
        pattern: "%JSONLD%",
        replacement: "<%= jsonldFile %>"
      },
      inlinemodernizr: {
        path: "build/",
        recursive: true,
        pattern: "%MODERNIZR%",
        replacement: "<%= modernizrFile %>"
      },
      // https://github.com/RealFaviconGenerator/realfavicongenerator/issues/207
      cleanManifestFilePaths: {
        path: "build/manifest.webapp",
        pattern: "\\\\/",
        replacement: "/"
      }
    },

    devUpdate: {
      main: {
        options: {
          updateType: "prompt",
          semver: false
        }
      }
    }
  });

  grunt.registerTask("default", ["compile", "watch"]);
  grunt.registerTask("compile", [
    "growl",
    "sass",
    "autoprefixer",
    "manifest:src"
  ]);
  grunt.registerTask("build", [
    "sass",
    "autoprefixer",
    "clean",
    "copy:build",
    "useminPrepare",
    "concat",
    "removelogging",
    "uglify",
    "cssmin",
    "rev",
    "usemin",
    "realFavicon",
    "sed",
    "manifest:build"
  ]);
  grunt.registerTask("up", ["devUpdate"]);
};
<|endoftext|>


<commit_before>var MOCHA_TIMEOUT = parseInt(process.env['OAE_TIMEOUTS_MOCHA'], 10) || 30000;

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

    var shell = require('shelljs');
    var mocha_grep = process.env['MOCHA_GREP'] || undefined;

    var regexErrors = false;

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jslint: {
            files:['Gruntfile.js', 'node_modules/oae-*/lib/**/*.js', 'node_modules/oae-*/tests/**/*.js',
                   'node_modules/oae-*/config/**/*.js'],
            directives: {
                node: true,
                predef: ['it', 'describe', 'beforeEach', 'before', 'afterEach', 'after'],
                sub: true,
                indent: 4,
                quotmark: 'single',
                curly: true
            },
            options: {
                shebang: true
            }
        },
        jshint: {
            options: {
                node: true,
                sub: true,
                indent: 4,
                trailing: true,
                quotmark: 'single',
                curly: true,
                white: false,
                strict: false,
                globals: {
                    it: true,
                    describe: true,
                    before: true,
                    beforeEach: true,
                    after: true,
                    afterEach: true
                }
            },
            files: '<%= jslint.files %>'
        },
        watch: {
            files: '<%= jslint.files %>',
            tasks: ['default']
        },
        simplemocha: {
            all: {
                src: ['node_modules/oae-tests/runner/beforeTests.js', 'node_modules/oae-*/tests/**/*.js'],
                options: {
                    timeout: MOCHA_TIMEOUT,
                    ignoreLeaks: true,
                    reporter: 'spec',
                    grep: mocha_grep
                }
            }
        },
        clean: [ 'target/' ],
        copy: {
            coverage: {
                files: {
                    'target/': '**'
                }
            }
        },
        replace: {
            jsdoc: {
                src: ['node_modules/oae-*/**/*.js'],
                overwrite: true,
                replacements: [
                    {
                        from: /@param (\S|\s\s)/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@param should be followed by 2 spaces';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@return \s/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@return should be followed by 1 space';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@returns/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='Use @return instead of @returns';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@throws \s/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@throws should be followed by 1 space';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    }
                ]
            }
        },
        showFile: 'target/coverage.html'
    });

    // Utility function for logging regex matches
    var logMatch = function(msg, matchedWord, index, fullText, regexMatches) {
        var lineNum = fullText.substring(0, index).match(/\n/g).length + 1;
        var line = fullText.split('\n')[lineNum - 1];
        grunt.log.writeln(msg.red + ': ' + lineNum + ': ' + line);
        regexErrors = true;
        return matchedWord;
    };

    // Task to run the regex task and fail if it matches anything
    grunt.registerTask('check-style', ['replace', 'jslint', 'checkRegexErrors']);
    grunt.registerTask('checkRegexErrors', function() {
        grunt.task.requires('replace');
        if (regexErrors) {
            grunt.warn('Style rule validation failed');
        }
    });

    // Make a task for running tests on a single module
    grunt.registerTask('test-module', 'Test a single module', function(module) {
        var config = {
            src: ['node_modules/oae-tests/runner/beforeTests.js', 'node_modules/' + module + '/tests/**/*.js'],
            options: {
                timeout: MOCHA_TIMEOUT,
                ignoreLeaks: true,
                reporter: 'spec',
                grep: mocha_grep
            }
        };
        grunt.config.set('simplemocha.' + module, config);
        grunt.task.run('simplemocha:' + module);
    });

    // Make a task for running jscoverage
    grunt.registerTask('jscoverage', 'Run jscoverage on the `target` dir', function() {
        grunt.task.requires('copy:coverage');
        console.log('node node_modules/oae-tests/runner/instrument_code.js "' + __dirname + '"')
        shell.exec('node node_modules/oae-tests/runner/instrument_code.js "' + __dirname + '"');
        grunt.log.writeln('Code instrumented'.green);
    });

    grunt.registerTask('test-instrumented', 'Runs mocha tests on the instrumented code', function() {
        // Mocha can't write to a file and simplemocha doesn't add that functionality, so we'll just shell.exec it here since we need the output :P
        shell.cd('target');
        // Set a covering environment variable, as this will be used to determine where the UI resides relative to the Hilary folder.
        shell.env['OAE_COVERING'] = true;
        var MODULES = grunt.file.expand({'filter': 'isDirectory'},'node_modules/oae-*/tests').join(' ');
        var output = shell.exec('../node_modules/.bin/mocha --ignore-leaks --timeout 20000 --reporter html-cov node_modules/oae-tests/runner/beforeTests.js ' + MODULES, {silent:true}).output;
        output.to('coverage.html');
        grunt.log.writeln('Code Coverage report generated at ' + 'target/coverage.html'.cyan);

    });

    // Make a task to open the browser
    grunt.registerTask('showFile', 'Open a file with the OS default viewer', function() {
        var browser = shell.env['BROWSER'];
        if (! browser) {
            if (process.platform === 'linux') {
                browser = 'xdg-open';
            } else if (process.platform === 'darwin') {
                browser = 'open';
            } else if (process.platform === 'win32') {
                browser = 'explorer.exe';
            }
        }
        if (browser) {
            shell.exec(browser + ' ' + (grunt.config.get('showFile') || 'coverage.html'));
        }
    });

    // Bring in tasks from npm
    grunt.loadNpmTasks('grunt-jslint');
    grunt.loadNpmTasks('grunt-simple-mocha');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');

    // Override default test task to use simplemocha
    grunt.registerTask('test', ['simplemocha']);
    // Run test coverage and open the report
    grunt.registerTask('test-coverage', ['clean', 'copy:coverage', 'jscoverage', 'test-instrumented', 'showFile']);
    // Default task.
    grunt.registerTask('default', ['check-style', 'test']);

};
<commit_msg>fix again<commit_after>var MOCHA_TIMEOUT = parseInt(process.env['OAE_TIMEOUTS_MOCHA'], 10) || 30000;

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

    var shell = require('shelljs');
    var mocha_grep = process.env['MOCHA_GREP'] || undefined;

    var regexErrors = false;

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jslint: {
            files:['Gruntfile.js', 'node_modules/oae-*/lib/**/*.js', 'node_modules/oae-*/tests/**/*.js',
                   'node_modules/oae-*/config/**/*.js'],
            directives: {
                node: true,
                predef: ['it', 'describe', 'beforeEach', 'before', 'afterEach', 'after'],
                sub: true,
                indent: 4,
                quotmark: 'single',
                curly: true
            },
            options: {
                shebang: true
            }
        },
        jshint: {
            options: {
                node: true,
                sub: true,
                indent: 4,
                trailing: true,
                quotmark: 'single',
                curly: true,
                white: false,
                strict: false,
                globals: {
                    it: true,
                    describe: true,
                    before: true,
                    beforeEach: true,
                    after: true,
                    afterEach: true
                }
            },
            files: '<%= jslint.files %>'
        },
        watch: {
            files: '<%= jslint.files %>',
            tasks: ['default']
        },
        simplemocha: {
            all: {
                src: ['node_modules/oae-tests/runner/beforeTests.js', 'node_modules/oae-*/tests/**/*.js'],
                options: {
                    timeout: MOCHA_TIMEOUT,
                    ignoreLeaks: true,
                    reporter: 'spec',
                    grep: mocha_grep
                }
            }
        },
        clean: [ 'target/' ],
        copy: {
            coverage: {
                files: {
                    'target/': '**'
                }
            }
        },
        replace: {
            jsdoc: {
                src: ['node_modules/oae-*/**/*.js'],
                overwrite: true,
                replacements: [
                    {
                        from: /@param (\S|\s\s)/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@param should be followed by 2 spaces';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@return \s/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@return should be followed by 1 space';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@returns/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='Use @return instead of @returns';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    },
                    {
                        from: /@throws \s/,
                        to: function(matchedWord, index, fullText, regexMatches) {
                            var msg ='@throws should be followed by 1 space';
                            return logMatch(msg, matchedWord, index, fullText, regexMatches);
                        }
                    }
                ]
            }
        },
        showFile: 'target/coverage.html'
    });

    // Utility function for logging regex matches
    var logMatch = function(msg, matchedWord, index, fullText, regexMatches) {
        var lineNum = fullText.substring(0, index).match(/\n/g).length + 1;
        var line = fullText.split('\n')[lineNum - 1];
        grunt.log.writeln(msg.red + ': ' + lineNum + ': ' + line);
        regexErrors = true;
        return matchedWord;
    };

    // Task to run the regex task and fail if it matches anything
    grunt.registerTask('check-style', ['replace', 'jslint', 'checkRegexErrors']);
    grunt.registerTask('checkRegexErrors', function() {
        grunt.task.requires('replace');
        if (regexErrors) {
            grunt.warn('Style rule validation failed');
        }
    });

    // Make a task for running tests on a single module
    grunt.registerTask('test-module', 'Test a single module', function(module) {
        var config = {
            src: ['node_modules/oae-tests/runner/beforeTests.js', 'node_modules/' + module + '/tests/**/*.js'],
            options: {
                timeout: MOCHA_TIMEOUT,
                ignoreLeaks: true,
                reporter: 'spec',
                grep: mocha_grep
            }
        };
        grunt.config.set('simplemocha.' + module, config);
        grunt.task.run('simplemocha:' + module);
    });

    // Make a task for running jscoverage
    grunt.registerTask('jscoverage', 'Run jscoverage on the `target` dir', function() {
        grunt.task.requires('copy:coverage');
        shell.exec('node node_modules/oae-tests/runner/instrument_code.js "' + __dirname + '"');
        grunt.log.writeln('Code instrumented'.green);
    });

    grunt.registerTask('test-instrumented', 'Runs mocha tests on the instrumented code', function() {
        // Mocha can't write to a file and simplemocha doesn't add that functionality, so we'll just shell.exec it here since we need the output :P
        shell.cd('target');
        // Set a covering environment variable, as this will be used to determine where the UI resides relative to the Hilary folder.
        shell.env['OAE_COVERING'] = true;
        var MODULES = grunt.file.expand({'filter': 'isDirectory'},'node_modules/oae-*/tests').join(' ');
        var output = shell.exec('../node_modules/.bin/mocha --ignore-leaks --timeout 20000 --reporter html-cov node_modules/oae-tests/runner/beforeTests.js ' + MODULES, {silent:true}).output;
        output.to('coverage.html');
        grunt.log.writeln('Code Coverage report generated at ' + 'target/coverage.html'.cyan);

    });

    // Make a task to open the browser
    grunt.registerTask('showFile', 'Open a file with the OS default viewer', function() {
        var browser = shell.env['BROWSER'];
        if (! browser) {
            if (process.platform === 'linux') {
                browser = 'xdg-open';
            } else if (process.platform === 'darwin') {
                browser = 'open';
            } else if (process.platform === 'win32') {
                browser = 'explorer.exe';
            }
        }
        if (browser) {
            shell.exec(browser + ' ' + (grunt.config.get('showFile') || 'coverage.html'));
        }
    });

    // Bring in tasks from npm
    grunt.loadNpmTasks('grunt-jslint');
    grunt.loadNpmTasks('grunt-simple-mocha');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');

    // Override default test task to use simplemocha
    grunt.registerTask('test', ['simplemocha']);
    // Run test coverage and open the report
    grunt.registerTask('test-coverage', ['clean', 'copy:coverage', 'jscoverage', 'test-instrumented', 'showFile']);
    // Default task.
    grunt.registerTask('default', ['check-style', 'test']);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt, {htmlbuild: 'grunt-html-build'});

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

		// watch
		watch: {
			html: {
				files: 'src/**/*.html',
				tasks: ['htmlbuild'],
				option: {
					interrupt: true
				}
			},

			css: {
				files: 'src/sass/*.scss',
				tasks: ['sass','csso:compress'],
				options: {
					interrupt: true
				}
			},

			js: {
				files: 'src/js/*.js',
				tasks: ['uglify'],
				options: {
					interrupt: true
				}
			},

			// Separate copy tasks instead of something like
			// tasks: ['sass', 'copy:css'] in the css watch task
			// as it's much faster
			wp_css: {
				files: 'dist/css/*.css',
				tasks: ['copy:css']
			},

			wp_js: {
				files: 'dist/js/*.js',
				tasks: ['copy:js']
			}
		},

		// tasks
		htmlbuild: {
			prod: {
				src: 'src/*.html',

				dest: 'dist/',

				options: {
					beautify: false,
					sections: {
						head1: 'src/parts/head1.part.html',
						head2: 'src/parts/head2.part.html',
						header: 'src/parts/header.part.html',
						footer: 'src/parts/footer.part.html'
					},

					styles: {
						critical_home: 'src/parts/critical-home.css'
					}
				}
			}
		},

		sass: {
			prod: {
				options: {
					style: 'compressed',
					//noCache: true
				},

				files: {
					'dist/css/style.css': 'src/sass/style.scss',
					'dist/css/old-ie.css': 'src/sass/old-ie.scss',
					'dist/css/really-old-ie.css': 'src/sass/really-old-ie.scss'
				}
			}
		},

		criticalcss: {
			tpl_home: {
				options: {
					//forceInclude: [],
					url: "127.0.0.1:4000",
					width: 1200,
					height: 900,
					outputfile: "src/parts/critical-home.css",
					filename: "dist/css/style.css",
					buffer: 800*1024
				}
			}
		},

		csso: {
			compress: {
				options: {
					report: 'gzip'
				},

				files: {
					'dist/css/style.css': ['dist/css/style.css']
				}
			},

			compress_critical: {
				options: {
					report: 'gzip'
				},

				files: {
					'src/parts/critical-home.css': ['src/parts/critical-home.css']
				}
			}
		},

		csslint: {
			prod: {
				options: {
					'import': 2,
					'empty-rules': 2,
					'compatible-vendor-prefixes': false,
					'box-sizing': false
				},

				src: ['css/style.css']
			}
		},

		uglify: {
			prod: {
				options: {
					preserveComments: false
				},

				files: {
					'dist/js/script.min.js': ['src/js/main.js','src/js/fonts.js']
				}
			}
		},

		jshint: {
			prod: ['Gruntfile.js']
		},

		svgmin: {
			prod: {
				options: {
					plugins: [
						{
							removeViewBox: false
						}
					]
				},

				files: [
					{
						expand: true,
						cwd: 'src/assets/svg',
						src: '{,*/}*.svg',
						dest: 'dist/images/'
					},

					{
						expand: true,
						cwd: 'src/assets/icons',
						src: '{,*/}*.svg',
						dest: 'src/assets/icons'
					}
				]
			}
		},

		svg2png: {
			prod: {
				files: [
					{
						cwd: 'src/assets/svg/',
						src: ['**/*.svg'],
						dest: 'src/assets/png/'
					}
				]
			}
		},

		imageoptim: { // imageOptim, imageAlpha and jpegMini need to be installed. Also see https://www.npmjs.com/package/imageoptim-cli#jpegmini-and-support-for-assistive-devices for jpegMini to work
			prod: {
				options: {
					jpegMini: true,
					imageAlpha: true,
					quitAfter: true
				},

				src: ['src/assets/png']
			}
		},

		grunticon: {
			prod: {
				files: [{
					expand: true,
					cwd: 'src/assets/icons/',
					src: ['*.svg', '*.png'],
					dest: 'dist/css/icons/'
				}],

				options: {
					enhanceSVG: true
					/*customselectors: {
						"*": [".icon-$1:before"]
						// (this is going to be very useful)
					}*/

				}
			}
		},

		copy: {
			frontend_images: {
				expand: true,
				cwd: 'src/assets/',
				src: '**',
				dest: 'dist/images/',
				flatten: true,
				filter: 'isFile'
			},

			icons: {
				files: [{
					expand: true,
					cwd: 'dist/css/icons/',
					src: ['**'],
					dest: 'wp-content/themes/THEME_NAME/css/icons/'
				}]
			},

			images: {
				files: [{
					expand: true,
					cwd: 'dist/images/',
					src: ['**'],
					dest: 'wp-content/themes/THEME_NAME/images/'
				}]
			},

			css: {
				files: [{
					expand: true,
					cwd: 'dist/css/',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/css/',
					isFile: true
				}]
			},

			critical: {
				files: [{
					expand: true,
					cwd: 'src/parts/',
					src: ['*.css'],
					dest: 'wp-content/themes/THEME_NAME/fe-includes/'
				}]
			},

			js: {
				files: [{
					expand: true,
					cwd: 'dist/js',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/js',
					isFile: true
				}]
			},

			fonts: {
				files: [{
					expand: true,
					cwd: 'dist/fonts',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/fonts',
					isFile: true
				}]
			}
		},

		// Connect plugin for server and synchronisation between browsers/devices
		connect: {
			server: {
				options: {
					port: 9001,
					hostname: '0.0.0.0',
					base: 'dist',
					keepalive: true
				}
			}
		}
	});

	grunt.registerTask('default', ['htmlbuild','sass','uglify','csslint','jshint']);

	grunt.registerTask('critical', ['criticalcss','csso:compress_critical','copy:critical']);

	grunt.registerTask('img', ['svgmin','grunticon','svg2png','imageoptim','copy:icons','copy:images']);

	grunt.registerTask('server', ['connect:server']);
};
<commit_msg>add missing path<commit_after>module.exports = function(grunt) {
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt, {htmlbuild: 'grunt-html-build'});

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

		// watch
		watch: {
			html: {
				files: 'src/**/*.html',
				tasks: ['htmlbuild'],
				option: {
					interrupt: true
				}
			},

			css: {
				files: 'src/sass/*.scss',
				tasks: ['sass','csso:compress'],
				options: {
					interrupt: true
				}
			},

			js: {
				files: 'src/js/*.js',
				tasks: ['uglify'],
				options: {
					interrupt: true
				}
			},

			// Separate copy tasks instead of something like
			// tasks: ['sass', 'copy:css'] in the css watch task
			// as it's much faster
			wp_css: {
				files: 'dist/css/*.css',
				tasks: ['copy:css']
			},

			wp_js: {
				files: 'dist/js/*.js',
				tasks: ['copy:js']
			}
		},

		// tasks
		htmlbuild: {
			prod: {
				src: 'src/*.html',

				dest: 'dist/',

				options: {
					beautify: false,
					sections: {
						head1: 'src/parts/head1.part.html',
						head2: 'src/parts/head2.part.html',
						header: 'src/parts/header.part.html',
						footer: 'src/parts/footer.part.html'
					},

					styles: {
						critical_home: 'src/parts/critical-home.css'
					}
				}
			}
		},

		sass: {
			prod: {
				options: {
					style: 'compressed',
					//noCache: true
				},

				files: {
					'dist/css/style.css': 'src/sass/style.scss',
					'dist/css/old-ie.css': 'src/sass/old-ie.scss',
					'dist/css/really-old-ie.css': 'src/sass/really-old-ie.scss'
				}
			}
		},

		criticalcss: {
			tpl_home: {
				options: {
					//forceInclude: [],
					url: "127.0.0.1:4000",
					width: 1200,
					height: 900,
					outputfile: "src/parts/critical-home.css",
					filename: "dist/css/style.css",
					buffer: 800*1024
				}
			}
		},

		csso: {
			compress: {
				options: {
					report: 'gzip'
				},

				files: {
					'dist/css/style.css': ['dist/css/style.css']
				}
			},

			compress_critical: {
				options: {
					report: 'gzip'
				},

				files: {
					'src/parts/critical-home.css': ['src/parts/critical-home.css']
				}
			}
		},

		csslint: {
			prod: {
				options: {
					'import': 2,
					'empty-rules': 2,
					'compatible-vendor-prefixes': false,
					'box-sizing': false
				},

				src: ['css/style.css']
			}
		},

		uglify: {
			prod: {
				options: {
					preserveComments: false
				},

				files: {
					'dist/js/script.min.js': ['src/js/main.js','src/js/fonts.js']
				}
			}
		},

		jshint: {
			prod: ['Gruntfile.js']
		},

		svgmin: {
			prod: {
				options: {
					plugins: [
						{
							removeViewBox: false
						}
					]
				},

				files: [
					{
						expand: true,
						cwd: 'src/assets/svg',
						src: '{,*/}*.svg',
						dest: 'dist/images/'
					},

					{
						expand: true,
						cwd: 'src/assets/icons',
						src: '{,*/}*.svg',
						dest: 'src/assets/icons'
					}
				]
			}
		},

		svg2png: {
			prod: {
				files: [
					{
						cwd: 'src/assets/svg/',
						src: ['**/*.svg'],
						dest: 'src/assets/png/'
					}
				]
			}
		},

		imageoptim: { // imageOptim, imageAlpha and jpegMini need to be installed. Also see https://www.npmjs.com/package/imageoptim-cli#jpegmini-and-support-for-assistive-devices for jpegMini to work
			prod: {
				options: {
					jpegMini: true,
					imageAlpha: true,
					quitAfter: true
				},

				src: ['src/assets/png', 'src/assets/jpg']
			}
		},

		grunticon: {
			prod: {
				files: [{
					expand: true,
					cwd: 'src/assets/icons/',
					src: ['*.svg', '*.png'],
					dest: 'dist/css/icons/'
				}],

				options: {
					enhanceSVG: true
					/*customselectors: {
						"*": [".icon-$1:before"]
						// (this is going to be very useful)
					}*/

				}
			}
		},

		copy: {
			frontend_images: {
				expand: true,
				cwd: 'src/assets/',
				src: '**',
				dest: 'dist/images/',
				flatten: true,
				filter: 'isFile'
			},

			icons: {
				files: [{
					expand: true,
					cwd: 'dist/css/icons/',
					src: ['**'],
					dest: 'wp-content/themes/THEME_NAME/css/icons/'
				}]
			},

			images: {
				files: [{
					expand: true,
					cwd: 'dist/images/',
					src: ['**'],
					dest: 'wp-content/themes/THEME_NAME/images/'
				}]
			},

			css: {
				files: [{
					expand: true,
					cwd: 'dist/css/',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/css/',
					isFile: true
				}]
			},

			critical: {
				files: [{
					expand: true,
					cwd: 'src/parts/',
					src: ['*.css'],
					dest: 'wp-content/themes/THEME_NAME/fe-includes/'
				}]
			},

			js: {
				files: [{
					expand: true,
					cwd: 'dist/js',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/js',
					isFile: true
				}]
			},

			fonts: {
				files: [{
					expand: true,
					cwd: 'dist/fonts',
					src: ['*'],
					dest: 'wp-content/themes/THEME_NAME/fonts',
					isFile: true
				}]
			}
		},

		// Connect plugin for server and synchronisation between browsers/devices
		connect: {
			server: {
				options: {
					port: 9001,
					hostname: '0.0.0.0',
					base: 'dist',
					keepalive: true
				}
			}
		}
	});

	grunt.registerTask('default', ['htmlbuild','sass','uglify','csslint','jshint']);

	grunt.registerTask('critical', ['criticalcss','csso:compress_critical','copy:critical']);

	grunt.registerTask('img', ['svgmin','grunticon','svg2png','imageoptim','copy:icons','copy:images']);

	grunt.registerTask('server', ['connect:server']);
};
<|endoftext|>