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

	grunt.initConfig({
		connect: {
			options: {
				port: 9001,
				livereload: 35729,
				hostname: 'localhost',
			},
			livereload: {
				options: {
					open: true,
					base: [
						'Weather-app'
					]
				}
			}
		},
		watch: {
			js: {
				files: ['Gruntfile.js', './src/js/**/*.js'],
				tasks: ['uglify'],
				options: {
					livereload: true
				}
			},
			stylus: {
				files: ['src/styles/**/*.styl'],
				tasks: ['stylus'],
				options: {
					livereload: true
				}
			},
			html: {
				files: ['src/views/**/*.html'],
				tasks: ['stylus'],
				options: {
					livereload: true
				}
			},
			livereload: {
				options: {
					livereload: '35729'
				},
				files: [
					'./src/js/**/*.js',
					'./src/styles/**/*.css',
					'./src/views/**/*.html',
					],
			}
		},
		uglify: {
			js: {
				compile: {
					options: {
						compress: true
					},

					files: {
						'./dist/app.min.js': './src/js/**/*.js'
					}
				}
			}
		},
		stylus: {
			compile: {
				options: {
					compress: true
				},
				files: {
					'./dist/app.min.css': './src/styles/**/*.styl'
				}
			}
		},
	});

	//Load plugins
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-stylus');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-watch');

	//Task lists
	grunt.registerTask('build', ['uglify', 'stylus', 'connect', 'watch']);
};
<commit_msg>Added babel to Gruntfile.js<commit_after>module.exports = function (grunt) {

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

	grunt.initConfig({
		connect: {
			options: {
				port: 9001,
				livereload: 35729,
				hostname: 'localhost',
			},
			livereload: {
				options: {
					open: true,
					base: [
						'Weather-app'
					]
				}
			}
		},
		watch: {
			js: {
				files: ['Gruntfile.js', './src/js/**/*.js'],
				tasks: ['uglify'],
				options: {
					livereload: true
				}
			},
			stylus: {
				files: ['src/styles/**/*.styl'],
				tasks: ['stylus'],
				options: {
					livereload: true
				}
			},
			html: {
				files: ['src/views/**/*.html'],
				tasks: ['stylus'],
				options: {
					livereload: true
				}
			},
			livereload: {
				options: {
					livereload: '35729'
				},
				files: [
					'./src/js/**/*.js',
					'./src/styles/**/*.css',
					'./src/styles/**/*.hbs',
					'./src/views/**/*.html'
					],
			}
		},
		uglify: {
			js: {
				compile: {
					options: {
						compress: true
					},

					files: {
						'./dist/app.min.js': './src/js/**/*.js'
					}
				}
			}
		},
		stylus: {
			compile: {
				options: {
					compress: true
				},
				files: {
					'./dist/app.min.css': './src/styles/**/*.styl'
				}
			}
		},
		babel: {
			options: {
				sourceMap: true,
				presets: ['babel-preset-es2015']
			},
			dist: {
				files: {
					'./dist/app.min.js': './src/js/**/*.js'
				}
			}
		},
	});

	//Load plugins
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-stylus');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-watch');

	//Task lists
	grunt.registerTask('build', ['babel', 'uglify', 'stylus', 'connect', 'watch']);
};
<|endoftext|>


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

var moment = require('moment'),
      path = require('path'),
  packager = require('electron-packager');

var os = (function(){
  var platform = process.platform;
  if (/^win/.test(platform))    { return "windows"; }
  if (/^darwin/.test(platform)) { return "mac"; }
  if (/^linux/.test(platform))  { return "linux"; }
  return null;
})();

var exe = {
  windows:  "electron.exe",
  mac:  "Electron.app/Contents/MacOS/Electron",
  linux:  "electron"
};

var electron_path = "electron";
var electron_version = "0.36.4";

var packageJson = require(__dirname + '/package.json');

//------------------------------------------------------------------------------
// ShellJS
//------------------------------------------------------------------------------

require('shelljs/global');
// shelljs/global makes the following imports:
//   cwd, pwd, ls, find, cp, rm, mv, mkdir, test, cat,
//   str.to, str.toEnd, sed, grep, which, echo,
//   pushd, popd, dirs, ln, exit, env, exec, chmod,
//   tempdir, error

var shellconfig = require('shelljs').config;
shellconfig.silent = false; // hide shell cmd output?
shellconfig.fatal = false;   // stop if cmd failed?

//------------------------------------------------------------------------------
// Grunt Config
//------------------------------------------------------------------------------

grunt.initConfig({

  'download-electron': {
    version: electron_version,
    outputDir: 'electron'
  }

});

//------------------------------------------------------------------------------
// Third-party tasks
//------------------------------------------------------------------------------

grunt.loadNpmTasks('grunt-download-electron');
if (os === "mac") {
  grunt.loadNpmTasks('grunt-appdmg');
}
grunt.loadNpmTasks('winresourcer');

//------------------------------------------------------------------------------
// Setup Tasks
//------------------------------------------------------------------------------

grunt.registerTask('setup', [
  'download-electron',
  'ensure-config-exists',
  'run-app-bower'
]);

grunt.registerTask('ensure-config-exists', function() {
  pushd("app");
  if (!test("-f", "config.json")) {
    grunt.log.writeln("Creating default config.json...");
    cp("example.config.json", "config.json");
  }
  popd();
});

grunt.registerTask('run-app-bower', function() {
  exec("bower install");
});

grunt.registerTask('cljsbuild-prod', function() {
  grunt.log.writeln("\nCleaning and building ClojureScript production files...");
  exec("lein do clean, with-profile production cljsbuild once");
});

grunt.registerTask('launch', function(async) {
  var IsAsync = (async == "true");
  grunt.log.writeln("\nLaunching development version...");
  var local_exe = exe[os];
  exec(path.join(electron_path, local_exe) + " app", {async:IsAsync});
});

grunt.registerTask('check-old', function() {
  grunt.log.writeln("\nChecking clojure dependencies");
  exec("lein ancient :all", {silent:false});
  grunt.log.writeln("\nChecking npm dependencies");
  exec("npm outdated", {silent:false});
  grunt.log.writeln("\nChecking bower dependencies");
  exec("bower list", {silent:false});
});

//------------------------------------------------------------------------------
// Test Tasks
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Release Helper functions
//------------------------------------------------------------------------------

function setReleaseConfig(build, paths) {
  grunt.log.writeln("\nRemoving config to force default release settings...");
  rm('-f', paths.releaseCfg);
  cp(paths.prodCfg, paths.releaseCfg);
}

function getBuildMeta() {
  grunt.log.writeln("Getting project metadata...");
  var tokens = cat("project.clj").split(" ");
  var build = {
    name:    tokens[1],
    version: tokens[2].replace(/"/g, "").trim(),
    date:    moment().format("YYYY-MM-DD")
  };
  var commit = exec("git rev-list HEAD --count", {silent:true}).output.trim();
  if (commit != '') {
    build.commit = "pre";
  } else {
    build.commit = commit;
  }
  build.releaseName = build.name + "-v" + build.version + "-" + build.commit;
  return build;
}

function getReleasePaths(build) {
  var paths = {
    builds: "builds",
    devApp: "app",
    rootPkg: "package.json"
  };
  paths.release = path.join(paths.builds, build.releaseName);
  paths.devPkg = path.join(paths.devApp, "package.json");
  paths.prodCfg = path.join(paths.devApp, "prod.config.json");
  paths.releaseApp = path.join(paths.builds, paths.devApp);
  paths.releasePkg = path.join(paths.releaseApp, "package.json");
  paths.releaseCfg = path.join(paths.releaseApp, "config.json");
  paths.releaseResources = path.join(paths.releaseApp, "components");
  return paths;
}

function getBasicReleaseInfo(build, paths) {
  var opts = {
    "dir": paths.releaseApp,
    "name": packageJson.name,
    "version": electron_version,
    "asar": true,
    "out": paths.release,
    "overwrite": true,
    "app-bundle-id": "com.example",
    "app-version": build.version,
    "version-string": {
      "ProductVersion": build.version,
      "ProductName": packageJson.name,
    }
  };
  return opts;
}

function stampRelease(build, paths) {
  grunt.log.writeln("\nStamping release with build metadata...");
  var pkg = grunt.file.readJSON(paths.releasePkg);
  pkg.version = build.version;
  pkg["build-commit"] = build.commit;
  pkg["build-date"] = build.date;
  JSON.stringify(pkg, null, "  ").to(paths.releasePkg);
}

function defineRelease(done, extra_opts, cb) {
  var callback = cb || (function () {});
  var build = getBuildMeta();
  var paths = getReleasePaths(build);
  var basic_opts = getBasicReleaseInfo(build, paths);
  var opts = Object.assign(basic_opts, extra_opts);

  packager(opts, function(err, appPath) {
    if (err) {
      grunt.log.writeln("Error: ".red, err);
    }
    if (appPath) {
      if (Array.isArray(appPath)) {
        appPath.forEach(function(i) {
          callback(i);
          grunt.log.writeln("Build: " + i.cyan);
        });
      } else {
        callback(appPath);
        grunt.log.writeln("Build: " + appPath.cyan);
      }
    }
    done(err);
  });
}

function deleteExtraResources(paths) {
  rm('-rf', path.join(paths.releaseApp, "js", "p", "out"));
}

//------------------------------------------------------------------------------
// Tasks
//------------------------------------------------------------------------------

grunt.registerTask('release', ['cljsbuild-prod', 'prepare-release', 'release-linux', 'release-mac', 'release-win']);

grunt.registerTask('cljsbuild-prod', function() {
  grunt.log.writeln("\nCleaning and building ClojureScript production files...");
  exec("lein do clean, with-profile production cljsbuild once");
});

grunt.registerTask('prepare-release', function() {
  var build = getBuildMeta();
  var paths = getReleasePaths(build);

  grunt.log.writeln("name:    "+build.name.cyan);
  grunt.log.writeln("version: "+build.version.cyan);
  grunt.log.writeln("date:    "+build.date.cyan);
  grunt.log.writeln("commit:  "+build.commit.cyan);
  grunt.log.writeln("release: "+build.releaseName.cyan);

  mkdir('-p', paths.builds);

  if (test("-d", paths.releaseApp)) {
    rm('-r', paths.releaseApp);
  }

  if (test("-d", paths.release)) {
    rm('-rf', paths.release);
  }

  //copy app folder
  cp('-r', paths.devApp, paths.builds);

  grunt.log.writeln("\nCopying node dependencies to release...");
  cp('-f', paths.rootPkg, paths.releaseApp);
  pushd(paths.releaseApp);
  exec('npm install --no-optional --production --silent');
  popd();
  cp('-f', paths.devPkg, paths.releaseApp);

  deleteExtraResources(paths);
  stampRelease(build, paths);
  setReleaseConfig(build, paths);
});

grunt.registerTask('release-linux', function() {
  var done = this.async();
  var opts = {
    "arch": ["x64"],
    "platform": "linux"
  }
  defineRelease(done, opts);
});

grunt.registerTask('makensis', function() {
  grunt.log.writeln("\nCreating installer...");
  var config = grunt.config.get("makensis");

  var ret = exec(["makensis",
                  "-DPRODUCT_VERSION=" + config.version,
                  "-DRELEASE_DIR=" + config.releaseDir,
                  "-DOUTFILE=" + config.outFile,
                  "scripts/build-windows-exe.nsi"].join(" "));

  if(ret.code === 0) {
    grunt.log.writeln("\nInstaller created. Removing win32 folder:", config.releaseDir.cyan);
    rm('-rf', config.releaseDir);
  }
});

grunt.registerTask('release-win', function() {
  var done = this.async();
  var build = getBuildMeta();
  var cb = function (appPath) {
    if (which("makensis")) {
      var dirName = path.join(appPath, "..");
      var exeName = path.join(dirName, path.basename(dirName) + ".exe");
      grunt.config.set("makensis", {
        version: build.version,
        releaseDir: path.resolve(appPath), // absolute paths required on linux
        outFile: path.resolve(exeName)
      });
      grunt.task.run("makensis");
    }
    else {
        grunt.log.writeln("\nSkipping windows installer creation:", "makensis not installed or not in path".cyan);
    }
  };

  var opts = {
    "arch": ["x64"],
    "platform": "win32",
    "icon": "app/img/logo.ico"
  }
  defineRelease(done, opts, cb);
});

grunt.registerTask('release-mac', function() {
  var done = this.async();
  var cb = null;
  if (os === "mac") {
    cb = function (f) {
      var dirName = path.join(f, "..")
      var dmgName = path.join(dirName, path.basename(dirName) + ".dmg");
      grunt.config.set("appdmg", {
        options: {
          "title": "zest",
          "background": "scripts/dmg/TestBkg.png",
          "icon-size": 80,
          "contents": [
            { "x": 448, "y": 344, "type": "link", "path": "/Applications" },
            { "x": 192, "y": 344, "type": "file", "path": path.join(f, packageJson.name + ".app") }
          ]
        },
        target: {
          dest: dmgName
        }
      });
      grunt.task.run("appdmg");
    }
  }
  var opts = {
    "arch": "x64",
    "platform": "darwin",
    "icon": "app/img/logo.icns"
  }
  defineRelease(done, opts, cb);
});

//------------------------------------------------------------------------------
// Default Task
//------------------------------------------------------------------------------

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

// end module.exports
};
<commit_msg>Electron 0.36.5 (fixes a crash)<commit_after>module.exports = function(grunt) {
'use strict';

var moment = require('moment'),
      path = require('path'),
  packager = require('electron-packager');

var os = (function(){
  var platform = process.platform;
  if (/^win/.test(platform))    { return "windows"; }
  if (/^darwin/.test(platform)) { return "mac"; }
  if (/^linux/.test(platform))  { return "linux"; }
  return null;
})();

var exe = {
  windows:  "electron.exe",
  mac:  "Electron.app/Contents/MacOS/Electron",
  linux:  "electron"
};

var electron_path = "electron";
var electron_version = "0.36.5";

var packageJson = require(__dirname + '/package.json');

//------------------------------------------------------------------------------
// ShellJS
//------------------------------------------------------------------------------

require('shelljs/global');
// shelljs/global makes the following imports:
//   cwd, pwd, ls, find, cp, rm, mv, mkdir, test, cat,
//   str.to, str.toEnd, sed, grep, which, echo,
//   pushd, popd, dirs, ln, exit, env, exec, chmod,
//   tempdir, error

var shellconfig = require('shelljs').config;
shellconfig.silent = false; // hide shell cmd output?
shellconfig.fatal = false;   // stop if cmd failed?

//------------------------------------------------------------------------------
// Grunt Config
//------------------------------------------------------------------------------

grunt.initConfig({

  'download-electron': {
    version: electron_version,
    outputDir: 'electron'
  }

});

//------------------------------------------------------------------------------
// Third-party tasks
//------------------------------------------------------------------------------

grunt.loadNpmTasks('grunt-download-electron');
if (os === "mac") {
  grunt.loadNpmTasks('grunt-appdmg');
}
grunt.loadNpmTasks('winresourcer');

//------------------------------------------------------------------------------
// Setup Tasks
//------------------------------------------------------------------------------

grunt.registerTask('setup', [
  'download-electron',
  'ensure-config-exists',
  'run-app-bower'
]);

grunt.registerTask('ensure-config-exists', function() {
  pushd("app");
  if (!test("-f", "config.json")) {
    grunt.log.writeln("Creating default config.json...");
    cp("example.config.json", "config.json");
  }
  popd();
});

grunt.registerTask('run-app-bower', function() {
  exec("bower install");
});

grunt.registerTask('cljsbuild-prod', function() {
  grunt.log.writeln("\nCleaning and building ClojureScript production files...");
  exec("lein do clean, with-profile production cljsbuild once");
});

grunt.registerTask('launch', function(async) {
  var IsAsync = (async == "true");
  grunt.log.writeln("\nLaunching development version...");
  var local_exe = exe[os];
  exec(path.join(electron_path, local_exe) + " app", {async:IsAsync});
});

grunt.registerTask('check-old', function() {
  grunt.log.writeln("\nChecking clojure dependencies");
  exec("lein ancient :all", {silent:false});
  grunt.log.writeln("\nChecking npm dependencies");
  exec("npm outdated", {silent:false});
  grunt.log.writeln("\nChecking bower dependencies");
  exec("bower list", {silent:false});
});

//------------------------------------------------------------------------------
// Test Tasks
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Release Helper functions
//------------------------------------------------------------------------------

function setReleaseConfig(build, paths) {
  grunt.log.writeln("\nRemoving config to force default release settings...");
  rm('-f', paths.releaseCfg);
  cp(paths.prodCfg, paths.releaseCfg);
}

function getBuildMeta() {
  grunt.log.writeln("Getting project metadata...");
  var tokens = cat("project.clj").split(" ");
  var build = {
    name:    tokens[1],
    version: tokens[2].replace(/"/g, "").trim(),
    date:    moment().format("YYYY-MM-DD")
  };
  var commit = exec("git rev-list HEAD --count", {silent:true}).output.trim();
  if (commit != '') {
    build.commit = "pre";
  } else {
    build.commit = commit;
  }
  build.releaseName = build.name + "-v" + build.version + "-" + build.commit;
  return build;
}

function getReleasePaths(build) {
  var paths = {
    builds: "builds",
    devApp: "app",
    rootPkg: "package.json"
  };
  paths.release = path.join(paths.builds, build.releaseName);
  paths.devPkg = path.join(paths.devApp, "package.json");
  paths.prodCfg = path.join(paths.devApp, "prod.config.json");
  paths.releaseApp = path.join(paths.builds, paths.devApp);
  paths.releasePkg = path.join(paths.releaseApp, "package.json");
  paths.releaseCfg = path.join(paths.releaseApp, "config.json");
  paths.releaseResources = path.join(paths.releaseApp, "components");
  return paths;
}

function getBasicReleaseInfo(build, paths) {
  var opts = {
    "dir": paths.releaseApp,
    "name": packageJson.name,
    "version": electron_version,
    "asar": true,
    "out": paths.release,
    "overwrite": true,
    "app-bundle-id": "com.example",
    "app-version": build.version,
    "version-string": {
      "ProductVersion": build.version,
      "ProductName": packageJson.name,
    }
  };
  return opts;
}

function stampRelease(build, paths) {
  grunt.log.writeln("\nStamping release with build metadata...");
  var pkg = grunt.file.readJSON(paths.releasePkg);
  pkg.version = build.version;
  pkg["build-commit"] = build.commit;
  pkg["build-date"] = build.date;
  JSON.stringify(pkg, null, "  ").to(paths.releasePkg);
}

function defineRelease(done, extra_opts, cb) {
  var callback = cb || (function () {});
  var build = getBuildMeta();
  var paths = getReleasePaths(build);
  var basic_opts = getBasicReleaseInfo(build, paths);
  var opts = Object.assign(basic_opts, extra_opts);

  packager(opts, function(err, appPath) {
    if (err) {
      grunt.log.writeln("Error: ".red, err);
    }
    if (appPath) {
      if (Array.isArray(appPath)) {
        appPath.forEach(function(i) {
          callback(i);
          grunt.log.writeln("Build: " + i.cyan);
        });
      } else {
        callback(appPath);
        grunt.log.writeln("Build: " + appPath.cyan);
      }
    }
    done(err);
  });
}

function deleteExtraResources(paths) {
  rm('-rf', path.join(paths.releaseApp, "js", "p", "out"));
}

//------------------------------------------------------------------------------
// Tasks
//------------------------------------------------------------------------------

grunt.registerTask('release', ['cljsbuild-prod', 'prepare-release', 'release-linux', 'release-mac', 'release-win']);

grunt.registerTask('cljsbuild-prod', function() {
  grunt.log.writeln("\nCleaning and building ClojureScript production files...");
  exec("lein do clean, with-profile production cljsbuild once");
});

grunt.registerTask('prepare-release', function() {
  var build = getBuildMeta();
  var paths = getReleasePaths(build);

  grunt.log.writeln("name:    "+build.name.cyan);
  grunt.log.writeln("version: "+build.version.cyan);
  grunt.log.writeln("date:    "+build.date.cyan);
  grunt.log.writeln("commit:  "+build.commit.cyan);
  grunt.log.writeln("release: "+build.releaseName.cyan);

  mkdir('-p', paths.builds);

  if (test("-d", paths.releaseApp)) {
    rm('-r', paths.releaseApp);
  }

  if (test("-d", paths.release)) {
    rm('-rf', paths.release);
  }

  //copy app folder
  cp('-r', paths.devApp, paths.builds);

  grunt.log.writeln("\nCopying node dependencies to release...");
  cp('-f', paths.rootPkg, paths.releaseApp);
  pushd(paths.releaseApp);
  exec('npm install --no-optional --production --silent');
  popd();
  cp('-f', paths.devPkg, paths.releaseApp);

  deleteExtraResources(paths);
  stampRelease(build, paths);
  setReleaseConfig(build, paths);
});

grunt.registerTask('release-linux', function() {
  var done = this.async();
  var opts = {
    "arch": ["x64"],
    "platform": "linux"
  }
  defineRelease(done, opts);
});

grunt.registerTask('makensis', function() {
  grunt.log.writeln("\nCreating installer...");
  var config = grunt.config.get("makensis");

  var ret = exec(["makensis",
                  "-DPRODUCT_VERSION=" + config.version,
                  "-DRELEASE_DIR=" + config.releaseDir,
                  "-DOUTFILE=" + config.outFile,
                  "scripts/build-windows-exe.nsi"].join(" "));

  if(ret.code === 0) {
    grunt.log.writeln("\nInstaller created. Removing win32 folder:", config.releaseDir.cyan);
    rm('-rf', config.releaseDir);
  }
});

grunt.registerTask('release-win', function() {
  var done = this.async();
  var build = getBuildMeta();
  var cb = function (appPath) {
    if (which("makensis")) {
      var dirName = path.join(appPath, "..");
      var exeName = path.join(dirName, path.basename(dirName) + ".exe");
      grunt.config.set("makensis", {
        version: build.version,
        releaseDir: path.resolve(appPath), // absolute paths required on linux
        outFile: path.resolve(exeName)
      });
      grunt.task.run("makensis");
    }
    else {
        grunt.log.writeln("\nSkipping windows installer creation:", "makensis not installed or not in path".cyan);
    }
  };

  var opts = {
    "arch": ["x64"],
    "platform": "win32",
    "icon": "app/img/logo.ico"
  }
  defineRelease(done, opts, cb);
});

grunt.registerTask('release-mac', function() {
  var done = this.async();
  var cb = null;
  if (os === "mac") {
    cb = function (f) {
      var dirName = path.join(f, "..")
      var dmgName = path.join(dirName, path.basename(dirName) + ".dmg");
      grunt.config.set("appdmg", {
        options: {
          "title": "zest",
          "background": "scripts/dmg/TestBkg.png",
          "icon-size": 80,
          "contents": [
            { "x": 448, "y": 344, "type": "link", "path": "/Applications" },
            { "x": 192, "y": 344, "type": "file", "path": path.join(f, packageJson.name + ".app") }
          ]
        },
        target: {
          dest: dmgName
        }
      });
      grunt.task.run("appdmg");
    }
  }
  var opts = {
    "arch": "x64",
    "platform": "darwin",
    "icon": "app/img/logo.icns"
  }
  defineRelease(done, opts, cb);
});

//------------------------------------------------------------------------------
// Default Task
//------------------------------------------------------------------------------

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

// end module.exports
};
<|endoftext|>


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

    // Load all Grunt tasks.
    require('load-grunt-tasks')(grunt);

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

        // Set up paths.
        paths: {
            src: {
                sass: 'src/style/Textpattern/sass/',
                js: 'src/style/Textpattern/js/',
                templates: 'src/style/Textpattern/'
            },
            dest: {
                css: 'public/style/Textpattern/css/',
                js: 'public/style/Textpattern/js/',
                templates: 'public/style/Textpattern/'
            }
        },

        // Set up timestamp.
        opt : {
            timestamp: '<%= new Date().getTime() %>'
        },

        // Clean distribution directory to start afresh.
        clean: [
            'public/style/'
        ],

        // Run some tasks in parallel to speed up the build process.
        concurrent: {
            dist: [
                'css',
                'copy:branding',
                'jshint',
                'theme'
            ]
        },

        // Copy files from `src/` and `bower_components/` to `public/`.
        copy: {
            branding: {
                files: [
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/',
                        src: ['**'],
                        dest: 'public/style/Textpattern/img/branding/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/apple-touch-icon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/favicon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/windows-site-tile/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    }
                ]
            },
            theme: {
                files: [
                    {
                        expand: true,
                        cwd: 'src/style/imports/',
                        src: ['**'],
                        dest: 'public/style/imports/'
                    },
                    {
                        expand: true,
                        cwd: 'src/style/',
                        src: ['Textpattern.css', '.htaccess'],
                        dest: 'public/style/'
                    },
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['**', '!*.tpl', '!sass/**', '!js/**'],
                        dest: '<%= paths.dest.templates %>'
                    }
                ]
            }
        },

        // Check code quality of Gruntfile.js and site-specific JavaScript using JSHint.
        jshint: {
            options: {
                bitwise: true,
                camelcase: true,
                curly: true,
                eqeqeq: true,
                es3: true,
                forin: true,
                immed: true,
                indent: 4,
                latedef: true,
                noarg: true,
                noempty: true,
                nonew: true,
                quotmark: 'single',
                undef: true,
                unused: true,
                strict: true,
                trailing: true,
                browser: true,
                globals: {
                    jQuery: true,
                    Zepto: true,
                    define: true,
                    module: true,
                    require: true,
                    requirejs: true,
                    ga: true,
                    responsiveNav: true,
                    Prism: true
                }
            },
            files: [
                'Gruntfile.js',
                'src/style/*/js/*.js'
            ]
        },

        // Add vendor prefixed styles and other post-processing transformations.
        postcss: {
            options: {
                processors: [
                    require('autoprefixer'),
                    require('cssnano')
                ]
            },
            dist: {
                src: '<%= paths.dest.css %>*.css'
            }
        },

        // Generate latest timestamp within theme template files.
        replace: {
            theme: {
                options: {
                    patterns: [
                        {
                            match: 'timestamp',
                            replacement: '<%= opt.timestamp %>'
                        },
                        {
                            match: 'year',
                            replacement: '<%= new Date().getFullYear() %>'
                        }
                    ]
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['*.tpl'],
                        dest: '<%= paths.dest.templates %>'
                    },
                    {
                        expand: true,
                        cwd: 'src/',
                        src: ['*.html'],
                        dest: 'public/'
                    },
                    {
                        src: '<%= paths.src.js %>main.js',
                        dest: '<%= paths.dest.js %>main.js'
                    }
                ]
            }
        },

        // Sass configuration.
        sass: {
            options: {
                outputStyle: 'expanded', // outputStyle = expanded, nested, compact or compressed.
                sourceMap: false
            },
            dist: {
                files: [
                    {'<%= paths.dest.css %>style.css': '<%= paths.src.sass %>style.scss'}
                ]
            }
        },

        // Validate Sass files via sass-lint.
        sasslint: {
            options: {
                configFile: '.sass-lint.yml'
            },
            target: ['<%= paths.src.sass %>**/*.scss']
        },

        // Run forum setup and postsetup scripts.
        shell: {
            setup: {
                command: [
                    'php src/setup/setup.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            },
            postsetup: {
                command: [
                    'php src/setup/post.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            }
        },

        // Uglify and copy JavaScript files from `bower-components`, and also `main.js`, to `public/assets/js/`.
        uglify: {
            dist: {
                // Preserve all comments that start with a bang (!) or include a closure compiler style.
                options: {
                    preserveComments: require('uglify-save-license')
                },
                files: [
                    {
                        '<%= paths.dest.js %>main.js': ['<%= paths.dest.js %>main.js'],
                        '<%= paths.dest.js %>prism.js': [
                            'node_modules/prismjs/prism.js',
                            // Add any plugins
                            // Add any additional languages
                            'node_modules/prismjs/components/prism-apacheconf.js',
                            'node_modules/prismjs/components/prism-coffeescript.js',
                            'node_modules/prismjs/components/prism-git.js',
                            'node_modules/prismjs/components/prism-haml.js',
                            'node_modules/prismjs/components/prism-json.js',
                            'node_modules/prismjs/components/prism-less.js',
                            'node_modules/prismjs/components/prism-markdown.js',
                            'node_modules/prismjs/components/prism-nginx.js',
                            'node_modules/prismjs/components/prism-perl.js',
                            'node_modules/prismjs/components/prism-php.js',
                            'node_modules/prismjs/components/prism-ruby.js',
                            'node_modules/prismjs/components/prism-sass.js',
                            'node_modules/prismjs/components/prism-scss.js',
                            'node_modules/prismjs/components/prism-sql.js',
                            'node_modules/prismjs/components/prism-stylus.js',
                            'node_modules/prismjs/components/prism-textile.js',
                            'node_modules/prismjs/components/prism-txp.js',
                            'node_modules/prismjs/components/prism-yaml.js'
                        ],
                        '<%= paths.dest.js %>require.js': ['node_modules/requirejs/require.js'],
                        '<%= paths.dest.js %>responsivenav.js': ['node_modules/responsive-nav/responsive-nav.js']
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/google-code-prettify/src/',
                        src: 'lang-*.js',
                        dest: '<%= paths.dest.js %>'
                    }
                ]
            }
        },

        // Directories watched and tasks performed by invoking `grunt watch`.
        watch: {
            sass: {
                files: '<%= paths.src.sass %>**/*.scss',
                tasks: 'css'
            },
            js: {
                files: '<%= paths.src.js %>**',
                tasks: ['jshint', 'uglify', 'compress:theme']
            },
            theme: {
                files: ['!src/style/*/sass/**', '!src/style/*/js/**', 'src/style/*/**', 'src/*.html'],
                tasks: ['theme']
            }
        }
    });

    // Register tasks.
    grunt.registerTask('build', ['clean', 'concurrent', 'uglify']);
    grunt.registerTask('default', ['watch']);
    grunt.registerTask('postsetup', ['shell:postsetup']);
    grunt.registerTask('css', ['sasslint', 'sass', 'postcss']);
    grunt.registerTask('setup', ['shell:setup', 'build']);
    grunt.registerTask('theme', ['copy:theme', 'replace']);
    grunt.registerTask('travis', ['jshint', 'build']);
};
<commit_msg>Update Uglify options for newer syntax<commit_after>module.exports = function (grunt)
{
    'use strict';

    // Load all Grunt tasks.
    require('load-grunt-tasks')(grunt);

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

        // Set up paths.
        paths: {
            src: {
                sass: 'src/style/Textpattern/sass/',
                js: 'src/style/Textpattern/js/',
                templates: 'src/style/Textpattern/'
            },
            dest: {
                css: 'public/style/Textpattern/css/',
                js: 'public/style/Textpattern/js/',
                templates: 'public/style/Textpattern/'
            }
        },

        // Set up timestamp.
        opt : {
            timestamp: '<%= new Date().getTime() %>'
        },

        // Clean distribution directory to start afresh.
        clean: [
            'public/style/'
        ],

        // Run some tasks in parallel to speed up the build process.
        concurrent: {
            dist: [
                'css',
                'copy:branding',
                'jshint',
                'theme'
            ]
        },

        // Copy files from `src/` and `bower_components/` to `public/`.
        copy: {
            branding: {
                files: [
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/',
                        src: ['**'],
                        dest: 'public/style/Textpattern/img/branding/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/apple-touch-icon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/favicon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/windows-site-tile/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    }
                ]
            },
            theme: {
                files: [
                    {
                        expand: true,
                        cwd: 'src/style/imports/',
                        src: ['**'],
                        dest: 'public/style/imports/'
                    },
                    {
                        expand: true,
                        cwd: 'src/style/',
                        src: ['Textpattern.css', '.htaccess'],
                        dest: 'public/style/'
                    },
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['**', '!*.tpl', '!sass/**', '!js/**'],
                        dest: '<%= paths.dest.templates %>'
                    }
                ]
            }
        },

        // Check code quality of Gruntfile.js and site-specific JavaScript using JSHint.
        jshint: {
            options: {
                bitwise: true,
                camelcase: true,
                curly: true,
                eqeqeq: true,
                es3: true,
                forin: true,
                immed: true,
                indent: 4,
                latedef: true,
                noarg: true,
                noempty: true,
                nonew: true,
                quotmark: 'single',
                undef: true,
                unused: true,
                strict: true,
                trailing: true,
                browser: true,
                globals: {
                    jQuery: true,
                    Zepto: true,
                    define: true,
                    module: true,
                    require: true,
                    requirejs: true,
                    ga: true,
                    responsiveNav: true,
                    Prism: true
                }
            },
            files: [
                'Gruntfile.js',
                'src/style/*/js/*.js'
            ]
        },

        // Add vendor prefixed styles and other post-processing transformations.
        postcss: {
            options: {
                processors: [
                    require('autoprefixer'),
                    require('cssnano')
                ]
            },
            dist: {
                src: '<%= paths.dest.css %>*.css'
            }
        },

        // Generate latest timestamp within theme template files.
        replace: {
            theme: {
                options: {
                    patterns: [
                        {
                            match: 'timestamp',
                            replacement: '<%= opt.timestamp %>'
                        },
                        {
                            match: 'year',
                            replacement: '<%= new Date().getFullYear() %>'
                        }
                    ]
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['*.tpl'],
                        dest: '<%= paths.dest.templates %>'
                    },
                    {
                        expand: true,
                        cwd: 'src/',
                        src: ['*.html'],
                        dest: 'public/'
                    },
                    {
                        src: '<%= paths.src.js %>main.js',
                        dest: '<%= paths.dest.js %>main.js'
                    }
                ]
            }
        },

        // Sass configuration.
        sass: {
            options: {
                outputStyle: 'expanded', // outputStyle = expanded, nested, compact or compressed.
                sourceMap: false
            },
            dist: {
                files: [
                    {'<%= paths.dest.css %>style.css': '<%= paths.src.sass %>style.scss'}
                ]
            }
        },

        // Validate Sass files via sass-lint.
        sasslint: {
            options: {
                configFile: '.sass-lint.yml'
            },
            target: ['<%= paths.src.sass %>**/*.scss']
        },

        // Run forum setup and postsetup scripts.
        shell: {
            setup: {
                command: [
                    'php src/setup/setup.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            },
            postsetup: {
                command: [
                    'php src/setup/post.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            }
        },

        // Uglify and copy JavaScript files from `bower-components`, and also `main.js`, to `public/assets/js/`.
        uglify: {
            dist: {
                // Preserve all comments that start with a bang (!) or include a closure compiler style.
                options: {
                    output: {
                        comments: require('uglify-save-license')
                    }
                },
                files: [
                    {
                        '<%= paths.dest.js %>main.js': ['<%= paths.dest.js %>main.js'],
                        '<%= paths.dest.js %>prism.js': [
                            'node_modules/prismjs/prism.js',
                            // Add any plugins
                            // Add any additional languages
                            'node_modules/prismjs/components/prism-apacheconf.js',
                            'node_modules/prismjs/components/prism-coffeescript.js',
                            'node_modules/prismjs/components/prism-git.js',
                            'node_modules/prismjs/components/prism-haml.js',
                            'node_modules/prismjs/components/prism-json.js',
                            'node_modules/prismjs/components/prism-less.js',
                            'node_modules/prismjs/components/prism-markdown.js',
                            'node_modules/prismjs/components/prism-nginx.js',
                            'node_modules/prismjs/components/prism-perl.js',
                            'node_modules/prismjs/components/prism-php.js',
                            'node_modules/prismjs/components/prism-ruby.js',
                            'node_modules/prismjs/components/prism-sass.js',
                            'node_modules/prismjs/components/prism-scss.js',
                            'node_modules/prismjs/components/prism-sql.js',
                            'node_modules/prismjs/components/prism-stylus.js',
                            'node_modules/prismjs/components/prism-textile.js',
                            'node_modules/prismjs/components/prism-txp.js',
                            'node_modules/prismjs/components/prism-yaml.js'
                        ],
                        '<%= paths.dest.js %>require.js': ['node_modules/requirejs/require.js'],
                        '<%= paths.dest.js %>responsivenav.js': ['node_modules/responsive-nav/responsive-nav.js']
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/google-code-prettify/src/',
                        src: 'lang-*.js',
                        dest: '<%= paths.dest.js %>'
                    }
                ]
            }
        },

        // Directories watched and tasks performed by invoking `grunt watch`.
        watch: {
            sass: {
                files: '<%= paths.src.sass %>**/*.scss',
                tasks: 'css'
            },
            js: {
                files: '<%= paths.src.js %>**',
                tasks: ['jshint', 'uglify', 'compress:theme']
            },
            theme: {
                files: ['!src/style/*/sass/**', '!src/style/*/js/**', 'src/style/*/**', 'src/*.html'],
                tasks: ['theme']
            }
        }
    });

    // Register tasks.
    grunt.registerTask('build', ['clean', 'concurrent', 'uglify']);
    grunt.registerTask('default', ['watch']);
    grunt.registerTask('postsetup', ['shell:postsetup']);
    grunt.registerTask('css', ['sasslint', 'sass', 'postcss']);
    grunt.registerTask('setup', ['shell:setup', 'build']);
    grunt.registerTask('theme', ['copy:theme', 'replace']);
    grunt.registerTask('travis', ['jshint', 'build']);
};
<|endoftext|>


<commit_before>'use strict';

var gulp = require('gulp'),
  $ = require('gulp-load-plugins')(),
  del = require('del'),
  lib = ['api/controllers/**/*.js', 'api/models/**/*.js', 'api/services/**/*.js'];

gulp.task('coverage', ['clean'], function(){
  return gulp.src(lib)
    .pipe($.istanbul())
    .pipe($.istanbul.hookRequire());
});

gulp.task('jshint', function () {
  return gulp.src(lib)
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.jshint.reporter('fail'));
});

function mochaStream(){
  return gulp.src('test/**/*.js', {read: false})
    .pipe($.mocha({
      reporter: 'spec'
    }));
}

gulp.task('mocha', ['coverage'], function () {
  return mochaStream()
    .pipe($.istanbul.writeReports());
});

gulp.task('mocha:nocov', function(){
  return mochaStream();
});

gulp.task('clean', del.bind(null, ['test/css', 'coverage/**/*']));

gulp.task('default', ['mocha', 'jshint']);
<commit_msg>handle error message.<commit_after>'use strict';

var gulp = require('gulp'),
  $ = require('gulp-load-plugins')(),
  del = require('del'),
  lib = ['api/controllers/**/*.js', 'api/models/**/*.js', 'api/services/**/*.js'];

gulp.task('coverage', ['clean'], function(){
  return gulp.src(lib)
    .pipe($.istanbul())
    .pipe($.istanbul.hookRequire());
});

gulp.task('jshint', function () {
  return gulp.src(lib)
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.jshint.reporter('fail'));
});

function mochaStream(){
  return gulp.src('test/**/*.js', {read: false})
    .pipe($.mocha({
      reporter: 'spec'
    }).on('error', function (error) {
      console.log('error caught');
    }));
}

gulp.task('mocha', ['coverage'], function () {
  return mochaStream()
    .pipe($.istanbul.writeReports());
});

gulp.task('mocha:nocov', function(){
  return mochaStream();
});

gulp.task('clean', del.bind(null, ['test/css', 'coverage/**/*']));

gulp.task('default', ['mocha', 'jshint']);
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {
    "use strict";
    var pkg, config;

    pkg = grunt.file.readJSON('package.json');

    config = {
        banner: [
            '/**\n',
            ' * <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n',
            ' * <%= pkg.description %>\n',
            ' *\n',
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n',
            ' * Licensed <%= pkg.license %>\n',
            ' */\n'
        ].join(''),

        sources: [
            'src/geotiff.js',
        ],
        pkg: pkg,
        uglifyFiles: {},
        browserifyFiles: {}
    };

    // setup dynamic filenames
    config.dist = ['dist/', '.js'].join(config.pkg.name);
    config.browserifyFiles[['dist/', '.js'].join(config.pkg.name)] = ["src/main.js"];
    config.uglifyFiles[['dist/', '.min.js'].join(config.pkg.name)] = config.dist;

    // Project configuration.
    grunt.initConfig({
        pkg: config.pkg,
        lint: {
            files: ['gruntfile.js', 'test/*.js', 'src/*']
        },
        clean: {
            dist: ['dist/']
        },
        concat: {
            options: {
                stripBanners: true,
                banner: config.banner
            },
            dist: {
                src: config.sources,
                dest: config.dist
            }
        },
        uglify: {
            options: { mangle: true },
            dist: {
                files: config.uglifyFiles
            }
        },
        jasmine : {
            tests : {
                src : ['dist/', '.js'].join(config.pkg.name),
                options : {
                    specs : 'test/*.spec.js',
                    //template : 'test/grunt.tmpl'
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'jshint.json'
            },
            all: ["src/*.js"]
        },
        connect: {
            livereload: true,
            options: {
                port: 9000,
                livereload: 35729,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
        },
        watch: {
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                tasks: ['jshint', 'browserify', 'mocha'],
                files: [
                    'test/*.html',
                    'src/*.js',
                    'test/*.spec.js'
                ]
            },

        },
        browserify: {
            dist: {
                files: config.browserifyFiles
            },
        },
        bump: {
            options: {
                pushTo: 'origin'
            }
        },

        karma: {
            all: {
                configFile: 'karma.conf.js'
            }
        },
        jsdoc: {
            dist: {
                src: ['src/*.js', 'test/*.js'],
                options: {
                    destination: 'docs'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-jsdoc');

    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-bump');

    // Default task.
    grunt.registerTask('default', ['jshint', 'clean', 'browserify', 'uglify']);

    grunt.registerTask('serve', ['jshint', 'browserify', 'connect:livereload', 'watch']);

    grunt.registerTask('test', ['jshint', 'karma']);
};
<commit_msg>Small fix in gruntfile<commit_after>'use strict';

module.exports = function(grunt) {
    "use strict";
    var pkg, config;

    pkg = grunt.file.readJSON('package.json');

    config = {
        banner: [
            '/**\n',
            ' * <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n',
            ' * <%= pkg.description %>\n',
            ' *\n',
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n',
            ' * Licensed <%= pkg.license %>\n',
            ' */\n'
        ].join(''),

        sources: [
            'src/geotiff.js',
        ],
        pkg: pkg,
        uglifyFiles: {},
        browserifyFiles: {}
    };

    // setup dynamic filenames
    config.dist = ['dist/', '.js'].join(config.pkg.name);
    config.browserifyFiles[['dist/', '.js'].join(config.pkg.name)] = ["src/main.js"];
    config.uglifyFiles[['dist/', '.min.js'].join(config.pkg.name)] = config.dist;

    // Project configuration.
    grunt.initConfig({
        pkg: config.pkg,
        lint: {
            files: ['gruntfile.js', 'test/*.js', 'src/*']
        },
        clean: {
            dist: ['dist/']
        },
        concat: {
            options: {
                stripBanners: true,
                banner: config.banner
            },
            dist: {
                src: config.sources,
                dest: config.dist
            }
        },
        uglify: {
            options: { mangle: true },
            dist: {
                files: config.uglifyFiles
            }
        },
        jasmine : {
            tests : {
                src : ['dist/', '.js'].join(config.pkg.name),
                options : {
                    specs : 'test/*.spec.js',
                    //template : 'test/grunt.tmpl'
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'jshint.json'
            },
            all: ["src/*.js"]
        },
        connect: {
            livereload: true,
            options: {
                port: 9000,
                livereload: 35729,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
        },
        watch: {
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                tasks: ['jshint', 'browserify'],
                files: [
                    'test/*.html',
                    'src/**/*.js',
                    'test/*.spec.js'
                ]
            },

        },
        browserify: {
            dist: {
                files: config.browserifyFiles
            },
        },
        bump: {
            options: {
                pushTo: 'origin'
            }
        },

        karma: {
            all: {
                configFile: 'karma.conf.js'
            }
        },
        jsdoc: {
            dist: {
                src: ['src/*.js', 'test/*.js'],
                options: {
                    destination: 'docs'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-jsdoc');

    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-bump');

    // Default task.
    grunt.registerTask('default', ['jshint', 'clean', 'browserify', 'uglify']);

    grunt.registerTask('serve', ['jshint', 'browserify', 'connect:livereload', 'watch']);

    grunt.registerTask('test', ['jshint', 'karma']);
};
<|endoftext|>


<commit_before>'use strict';
module.exports = prepareGrunt;

/**
 * Sets up grunt for functioning with the specific add ins/modules and
 * configuration we provide in this gruntfile.js.
 * @param {grunt} grunt
 */
function prepareGrunt(grunt) {
    var allFiles = [
        'package.json',
        'Gruntfile.js',
        'lib/**/*.js',
        'spec/**/*',
        '.jshintrc',
        'spec/**/.jshintrc',
        'lib/**/.jshintrc'
    ];

    var allConfigFiles = [
        'Gruntfile.js'
    ];

    var allLibFiles = [
        'Gruntfile.js',
        'lib/**/*.js',
        'index.js'
    ];

    var allSpecFiles = [
        'spec/**/*-spec.js'
    ];

    var allIgnoreFiles = [
        'node_modules/**/*',
        'spec/**/*-disabled.js'
    ];

    // grunt configuration.
    grunt.initConfig({

            // grunt-contrib-jshint
            jshint: {
                // grunt jshint:source
                // will check the source files only
                source: {
                    src: allLibFiles
                },
                // grunt jshint:spec
                // will check the spec files only
                spec: {
                    src: allSpecFiles,
                    // use test specific .jshintrc for spec folder
                    options: {
                        jshintrc: 'spec/.jshintrc'
                    }
                },
                options: {
                    // default to the root .jshintrc
                    jshintrc: '.jshintrc',

                    // ensure we don't waste our time on files we have
                    // explicitly disabled or that we have brought in from
                    // other libraries.
                    ignores: allIgnoreFiles
                }
            },

            // grunt-contrib-watch
            watch: {
                // use with 'grunt watch' from command line ensure we reload
                // our watches when ANY of these files change.
                files: allConfigFiles,
                options: {
                    reload: true
                },
                jshint: {
                    files: allFiles,
                    tasks: ['jshint'],
                    options: {
                        interrupt: true,
                        atBegin: true
                    }
                },
                // grunt watch:mochaTest
                mochaTest: {
                    files: allFiles,
                    tasks: ['coverage'],
                    options: {
                        interrupt: true,
                        atBegin: true
                    }
                }
            },

            // grunt-mocha-test
            mochaTest: {
                // run all tests
                test: {
                    options: {
                        reporter: 'spec',
                        require: 'spec/helper'
                    },
                    src: allSpecFiles
                },
                min: {
                    options: {
                        reporter: 'spec',
                        require: 'spec/helper'
                    },
                    src: allSpecFiles
                }
            },

            'mocha_istanbul': {
                coverage: {
                    src: 'spec',
                    options: {
                        excludes: [
                            'spec/**/*.js'
                        ],
                        mask: '**/*-spec.js',
                        reportFormats: ['html'],
                        mochaOptions: [
                            '--require',
                            'spec/helper'
                        ]
                    }
                }
            },
            yaml: {
                monorail: {
                    options: {
                        ignored: /^_/,
                        space: 4,
                        customTypes: {
                        }
                    },
                    files: [
                        {
                            expand: true,
                            cwd: 'static/',
                            src: ['monorail.yml'],
                            dest: 'build/swagger-json/'
                        }
                    ]
                },
            },
            'swagger-js-codegen': {
                options: {
                    apis: [
                        {
                            swagger: 'build/swagger-json/monorail.json',
                            fileName: 'monorail_node_client.js',
                            className: 'Monorail'
                        }
                    ],
                    dest: 'build/monorail-node-client'
                },
                dist: {}
            }
        });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-swagger-js-codegen');
    grunt.loadNpmTasks('grunt-yaml');

    // Whenever the "swagger" task is run, run these tasks
    grunt.registerTask('swagger', ['yaml:monorail','swagger-js-codegen']);

    // Whenever the "coverage" task is run, run these tasks
    grunt.registerTask('coverage', ['mocha_istanbul:coverage']);

    // Whenever the "test" task is run, run these tasks
    grunt.registerTask('test', ['jshint', 'mochaTest:test']);

    // By default, lint and run all tests.
    grunt.registerTask('default', ['jshint', 'coverage', 'swagger']);
}

<commit_msg>change the ultimate output directory for the yml->json and the node client library produced by grunt swagger command<commit_after>'use strict';
module.exports = prepareGrunt;

/**
 * Sets up grunt for functioning with the specific add ins/modules and
 * configuration we provide in this gruntfile.js.
 * @param {grunt} grunt
 */
function prepareGrunt(grunt) {
    var allFiles = [
        'package.json',
        'Gruntfile.js',
        'lib/**/*.js',
        'spec/**/*',
        '.jshintrc',
        'spec/**/.jshintrc',
        'lib/**/.jshintrc'
    ];

    var allConfigFiles = [
        'Gruntfile.js'
    ];

    var allLibFiles = [
        'Gruntfile.js',
        'lib/**/*.js',
        'index.js'
    ];

    var allSpecFiles = [
        'spec/**/*-spec.js'
    ];

    var allIgnoreFiles = [
        'node_modules/**/*',
        'spec/**/*-disabled.js'
    ];

    // grunt configuration.
    grunt.initConfig({

            // grunt-contrib-jshint
            jshint: {
                // grunt jshint:source
                // will check the source files only
                source: {
                    src: allLibFiles
                },
                // grunt jshint:spec
                // will check the spec files only
                spec: {
                    src: allSpecFiles,
                    // use test specific .jshintrc for spec folder
                    options: {
                        jshintrc: 'spec/.jshintrc'
                    }
                },
                options: {
                    // default to the root .jshintrc
                    jshintrc: '.jshintrc',

                    // ensure we don't waste our time on files we have
                    // explicitly disabled or that we have brought in from
                    // other libraries.
                    ignores: allIgnoreFiles
                }
            },

            // grunt-contrib-watch
            watch: {
                // use with 'grunt watch' from command line ensure we reload
                // our watches when ANY of these files change.
                files: allConfigFiles,
                options: {
                    reload: true
                },
                jshint: {
                    files: allFiles,
                    tasks: ['jshint'],
                    options: {
                        interrupt: true,
                        atBegin: true
                    }
                },
                // grunt watch:mochaTest
                mochaTest: {
                    files: allFiles,
                    tasks: ['coverage'],
                    options: {
                        interrupt: true,
                        atBegin: true
                    }
                }
            },

            // grunt-mocha-test
            mochaTest: {
                // run all tests
                test: {
                    options: {
                        reporter: 'spec',
                        require: 'spec/helper'
                    },
                    src: allSpecFiles
                },
                min: {
                    options: {
                        reporter: 'spec',
                        require: 'spec/helper'
                    },
                    src: allSpecFiles
                }
            },

            'mocha_istanbul': {
                coverage: {
                    src: 'spec',
                    options: {
                        excludes: [
                            'spec/**/*.js'
                        ],
                        mask: '**/*-spec.js',
                        reportFormats: ['html'],
                        mochaOptions: [
                            '--require',
                            'spec/helper'
                        ]
                    }
                }
            },
            yaml: {
                monorail: {
                    options: {
                        ignored: /^_/,
                        space: 4,
                        customTypes: {
                        }
                    },
                    files: [
                        {
                            expand: true,
                            cwd: 'static/',
                            src: ['monorail.yml'],
                            dest: 'build/client_libs/'
                        }
                    ]
                },
            },
            'swagger-js-codegen': {
                options: {
                    apis: [
                        {
                            swagger: 'build/client_libs/monorail.json',
                            fileName: 'monorail_node_client.js',
                            className: 'Monorail'
                        }
                    ],
                    dest: 'build/nodejs'
                },
                dist: {}
            }
        });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-swagger-js-codegen');
    grunt.loadNpmTasks('grunt-yaml');

    // Whenever the "swagger" task is run, run these tasks
    grunt.registerTask('swagger', ['yaml:monorail','swagger-js-codegen']);

    // Whenever the "coverage" task is run, run these tasks
    grunt.registerTask('coverage', ['mocha_istanbul:coverage']);

    // Whenever the "test" task is run, run these tasks
    grunt.registerTask('test', ['jshint', 'mochaTest:test']);

    // By default, lint and run all tests.
    grunt.registerTask('default', ['jshint', 'coverage', 'swagger']);
}

<|endoftext|>


<commit_before>var gulp = require('gulp'),
    sass = require('gulp-sass'),
    uglify = require('gulp-uglify'),
    minifyCss = require('gulp-minify-css'),
    rename = require('gulp-rename'),
    autoprefixer = require('gulp-autoprefixer');

gulp.task('sass', function() {
    gulp.src('scss/**/*.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer({
            browsers: ['last 5 versions', '> 5%', 'ie 9', 'ie 8'],
            cascade: false
        }))
        .pipe(gulp.dest('css'));
});

gulp.task('minify-css', function() {
    return gulp.src(['css/**/*.css', '!css/**/*.min.css'])
        .pipe(rename({ suffix: '.min' }))
        .pipe(minifyCss({ compatibility: 'ie8' }))
        .pipe(gulp.dest('css'))
});

gulp.task('uglify', function() {
    return gulp.src(['js/**/*.js', '!js/**/*.min.js'])
        .pipe(rename({ suffix: '.min' }))
        .pipe(uglify())
        .pipe(gulp.dest('js'))
});

gulp.task('watch', function() {
    gulp.watch('scss/**/*.scss', ['sass']);
    gulp.watch(['css/**/*.css', '!css/**/*.min.css'], ['minify-css']);
    gulp.watch(['js/**/*.js', '!js/**/*.min.js'], ['uglify']);
});

gulp.task('default', ['sass', 'minify-css', 'uglify', 'watch']);<commit_msg>Updated gulp file<commit_after>var gulp = require('gulp'),
    sass = require('gulp-sass'),
    uglify = require('gulp-uglify'),
    minifyCss = require('gulp-minify-css'),
    rename = require('gulp-rename'),
    autoprefixer = require('gulp-autoprefixer');

gulp.task('sass', function() {
    gulp.src('scss/**/*.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer({
            browsers: ['last 5 versions', '> 5%', 'ie 9', 'ie 8'],
            cascade: false
        }))
        .pipe(gulp.dest('css'));
});

gulp.task('minify-css', function() {
    return gulp.src(['css/**/*.css', '!css/**/*.min.css'])
        .pipe(rename({ suffix: '.min' }))
        .pipe(minifyCss({ compatibility: 'ie8' }))
        .pipe(gulp.dest('css'));
});

gulp.task('uglify', function() {
    return gulp.src(['js/**/*.js', '!js/**/*.min.js'])
        .pipe(rename({ suffix: '.min' }))
        .pipe(uglify())
        .pipe(gulp.dest('js'));
});

gulp.task('watch', function() {
    gulp.watch('scss/**/*.scss', ['sass']);
    gulp.watch(['css/**/*.css', '!css/**/*.min.css'], ['minify-css']);
    gulp.watch(['js/**/*.js', '!js/**/*.min.js'], ['uglify']);
});

gulp.task('default', ['sass', 'minify-css', 'uglify', 'watch']);<|endoftext|>


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

    require('google-closure-compiler').grunt(grunt);

    grunt.initConfig({
        concurrent: {
            tasks: ['watch'],
            options: {
                logConcurrentOutput: true
            }
        },
        watch: {
            test: {
                files: ['test/**/*.js'],
                tasks: [
                    'karma'
                ]
            },
            js: {
                files: ['src/**'],
                tasks: [
                    'closureCompiler:targetName',
                    'karma',
                    'jshint',
                    'less'
                ]
            }
        },
        less: {
            options: {
                compress: false
            },
            development: {
                files: {
                    "dist/entry.css": "src/css/*.less"
                }
            }
        },
        jshint: {
            all: [
                'src/**/*.js'
            ],
            options: {
                jshintrc: true,
                ignores: ['src/blocks/*.js']
            }
        },
        karma: {
            options: {
                frameworks: ['mocha', 'chai'],
                files: [
                    'test_util/*.js',
                    'extern/jquery/jquery.js',
                    'extern/blockly/blockly_compressed.js',
                    'dist/entry.js'
                ]
            },
            unit: {
                configFile: 'karma.conf.js',
                logLevel: 'ERROR',
                files: [
                    { src : ['test/**/*.js'] }
                ]
            }
        },
        'closure-compiler': {
            develop: {
                files: {
                    'dist/entry.js': ['src/entry.js', 'src/util/**/*.js', 'src/property_panel.js', 'src/**/*.js']
                },
                options: {
                    compilation_level: 'SIMPLE_OPTIMIZATIONS',
                    language_in: 'ECMASCRIPT5',
                    language_out: 'ECMASCRIPT5',
                    formatting: 'pretty_print'
                }
            },
            dist: {
                files: {
                    'dist/entry.min.js': ['src/entry.js', 'src/util/**/*.js', 'src/property_panel.js', 'src/**/*.js']
                },
                options: {
                    create_source_map: 'entry.js.map',
                    compilation_level: 'SIMPLE_OPTIMIZATIONS',
                    language_in: 'ECMASCRIPT5',
                    language_out: 'ECMASCRIPT5'
                }
            }
        },
        closureCompiler: {
            options: {
                compilerFile: 'node_modules/closurecompiler/compiler/compiler.jar',
                checkModified: true,
                compilerOpts: {
                    create_source_map: 'entry.js.map',
                    compilation_level: 'SIMPLE_OPTIMIZATIONS',
                    language_in: 'ECMASCRIPT5',
                    language_out: 'ECMASCRIPT5',
                    formatting: 'pretty_print'
                }
            },
            targetName: {
                src: ['src/entry.js', 'src/**/*.js', '!src/workspace/block_entry.js'],
                dest: 'dist/entry.js'
            },
            dist: {
                options: {
                    compilerOpts: {
                        compilation_level: 'SIMPLE_OPTIMIZATIONS',
                        language_in: 'ECMASCRIPT5',
                        language_out: 'ECMASCRIPT5'
                    }
                },
                expand: false,
                src: ['src/entry.js', 'src/**/*.js'],
                dest: 'dist/entry.min.js',
                ext: '.min.js'
            }
        }
    });

    // Load NPM tasks
    grunt.loadNpmTasks('grunt-closure-tools');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-contrib-less');

    grunt.option('force', true);

    // Default tasks.
    grunt.registerTask('default', [
        'closureCompiler',
        'karma',
        'jshint',
        'less'
    ]);

    grunt.registerTask('development', [
        'watch',
        'closureCompiler:targetName',
        'karma',
        'concurrent'
    ]);

    grunt.registerTask('closure', ['closureCompiler']);

    grunt.registerTask('build', [
        'closure-compiler',
        'less'
    ]);
};
<commit_msg>closure-compile 방식 변경<commit_after>module.exports = function(grunt) {
    'use strict';

    var ClosureCompiler = require('google-closure-compiler').compiler;

    grunt.initConfig({
        concurrent: {
            tasks: ['watch'],
            options: {
                logConcurrentOutput: true
            }
        },
        watch: {
            test: {
                files: ['test/**/*.js'],
                tasks: [
                    'karma'
                ]
            },
            js: {
                files: ['src/**'],
                tasks: [
                    'closureCompiler:targetName',
                    'karma',
                    'jshint',
                    'less'
                ]
            }
        },
        less: {
            options: {
                compress: false
            },
            development: {
                files: {
                    "dist/entry.css": "src/css/*.less"
                }
            }
        },
        jshint: {
            all: [
                'src/**/*.js'
            ],
            options: {
                jshintrc: true,
                ignores: ['src/blocks/*.js']
            }
        },
        karma: {
            options: {
                frameworks: ['mocha', 'chai'],
                files: [
                    'test_util/*.js',
                    'extern/jquery/jquery.js',
                    'extern/blockly/blockly_compressed.js',
                    'dist/entry.js'
                ]
            },
            unit: {
                configFile: 'karma.conf.js',
                logLevel: 'ERROR',
                files: [
                    { src : ['test/**/*.js'] }
                ]
            }
        },
        closureCompiler: {
            options: {
                compilerFile: ClosureCompiler.COMPILER_PATH,
                checkModified: true,
                compilerOpts: {
                    create_source_map: 'entry.js.map',
                    compilation_level: 'SIMPLE_OPTIMIZATIONS',
                    language_in: 'ECMASCRIPT5',
                    language_out: 'ECMASCRIPT5',
                    formatting: 'pretty_print'
                }
            },
            targetName: {
                src: ['src/entry.js', 'src/**/*.js', '!src/workspace/block_entry.js'],
                dest: 'dist/entry.js'
            },
            dist: {
                options: {
                    compilerOpts: {
                        compilation_level: 'SIMPLE_OPTIMIZATIONS',
                        language_in: 'ECMASCRIPT5',
                        language_out: 'ECMASCRIPT5'
                    }
                },
                expand: false,
                src: ['src/entry.js', 'src/**/*.js'],
                dest: 'dist/entry.min.js',
                ext: '.min.js'
            }
        }
    });

    // Load NPM tasks
    grunt.loadNpmTasks('grunt-closure-tools');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-contrib-less');

    grunt.option('force', true);

    // Default tasks.
    grunt.registerTask('default', [
        'closureCompiler',
        'karma',
        'jshint',
        'less'
    ]);

    grunt.registerTask('development', [
        'watch',
        'closureCompiler:targetName',
        'karma',
        'concurrent'
    ]);

    grunt.registerTask('closure', ['closureCompiler']);

    grunt.registerTask('build', [
        'closureCompiler',
        'less'
    ]);
};
<|endoftext|>


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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '_source/js/*.js',
        '!_source/js/main.js'
      ]
    },
    shell: {
      jekyllBuild: {
        command: 'jekyll build'
      }
    },
    connect: {
      server: {
        options: {
          port: 4000,
          base: '_site'
        }
      }
    },
    watch: {
      jekyll: {
        files: [
          '_config.yml',
          '_source/*.*',
          '_source/_layouts/**',
          '_source/_includes/**',
          '_source/_posts/**',
          '_source/_work/**'
        ],
        tasks: ['shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      sass: {
        files: [
          '_source/_sass/*.scss'
        ],
        tasks: ['sass', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      images: {
        files: [
          '_source/_images/*.{png,jpg,jpeg}'],
        tasks: ['newer:imagemin', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      svgs: {
        files: [
          '_source/_images/*.svg'],
        tasks: ['newer:svgmin', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      }
    },
    sass: {
      dist: {
        options: {
          sourcemap: false,
          style: 'compressed',
          compass: false,
        },
        files: {
          '_source/css/main.min.css':'_source/_sass/main.scss'
        }
      },
      dev: {
        options: {
          sourcemap: false,
          compass: false,
        },
        files: {
          '_source/css/main.css':'_source/_sass/main.scss'
        }
      }
    },
    uglify: {
      dist: {
        options: {
          banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */',
          compress: true,
          beautify: false,
          mangle: false
        },
        files: {
          '_source/js/main.js': [
            '_source/js/plugins/*.js',
            '_source/js/_*.js'
          ]
        }
      }
    },
    imagemin: {
      dist: {
        options: {
          optimizationLevel: 7,
          progressive: true
        },
        files: [{
          expand: true,
          cwd: '_source/_images/',
          src: '{,*/}*.{png,jpg,jpeg}',
          dest: '_source/images/'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '_source/_images/',
          src: '{,*/}*.svg',
          dest: '_source/images/'
        }]
      }
    },
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-svgmin');
  grunt.loadNpmTasks('grunt-newer');

  // Register tasks
  grunt.registerTask('default', ['jshint', 'uglify', 'newer:imagemin', 'newer:svgmin']);
  grunt.registerTask('serve', ['shell', 'connect', 'watch']);
  grunt.registerTask('optimize', ['imagemin', 'svgmin']);

};<commit_msg>Update paths<commit_after>'use strict';
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'js/*.js',
        '!js/main.js'
      ]
    },
    shell: {
      jekyllBuild: {
        command: 'jekyll build'
      }
    },
    connect: {
      server: {
        options: {
          port: 4000,
          base: '_site'
        }
      }
    },
    watch: {
      jekyll: {
        files: [
          '_config.yml',
          '*.*',
          '_layouts/**',
          '_includes/**',
          '_posts/**',
          '_work/**'
        ],
        tasks: ['shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      sass: {
        files: [
          '_sass/*.scss'
        ],
        tasks: ['sass', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      images: {
        files: [
          '_images/*.{png,jpg,jpeg}'],
        tasks: ['newer:imagemin', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      },
      svgs: {
        files: [
          '_images/*.svg'],
        tasks: ['newer:svgmin', 'shell:jekyllBuild'],
        options: {
          livereload: true
        }
      }
    },
    sass: {
      dist: {
        options: {
          sourcemap: false,
          style: 'compressed',
          compass: false,
        },
        files: {
          'css/main.min.css':'_sass/main.scss'
        }
      },
      dev: {
        options: {
          sourcemap: false,
          compass: false,
        },
        files: {
          'css/main.css':'_sass/main.scss'
        }
      }
    },
    uglify: {
      dist: {
        options: {
          banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */',
          compress: true,
          beautify: false,
          mangle: false
        },
        files: {
          'js/main.js': [
            'js/plugins/*.js',
            'js/_*.js'
          ]
        }
      }
    },
    imagemin: {
      dist: {
        options: {
          optimizationLevel: 7,
          progressive: true
        },
        files: [{
          expand: true,
          cwd: '_images/',
          src: '{,*/}*.{png,jpg,jpeg}',
          dest: 'images/'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '_images/',
          src: '{,*/}*.svg',
          dest: 'images/'
        }]
      }
    },
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-svgmin');
  grunt.loadNpmTasks('grunt-newer');

  // Register tasks
  grunt.registerTask('default', ['jshint', 'uglify', 'newer:imagemin', 'newer:svgmin']);
  grunt.registerTask('serve', ['shell', 'connect', 'watch']);
  grunt.registerTask('optimize', ['imagemin', 'svgmin']);

};<|endoftext|>