Skip to content

Instantly share code, notes, and snippets.

@raykendo
Last active March 17, 2016 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raykendo/9b2c66f26147d6f52939 to your computer and use it in GitHub Desktop.
Save raykendo/9b2c66f26147d6f52939 to your computer and use it in GitHub Desktop.
Grunt Work: Generic Grunt setup for my ArcGIS JSAPI Applications (work in progress)
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
browser: true,
'-W083': true, // don't form functions within loops (hard when calling Array.prototype.forEach inside another Array.prototype.forEach)
scripturl: true, // no script URL (I sometimes use javascript:void(0); instead of # when I have routes)
globals: {
define: true,
require: true,
console: true,
module: true
}
}
},
requirejs: {
compile: {
options: {
baseUrl: '.',
appDir: 'src',
dir: 'js',
optimize: 'uglify2'
}
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'requirejs:compile']
},
jsdoc: {
dist: {
src: ['src/**/*.js'],
options: {
destination: 'doc',
template: "node_modules/ink-docstrap/template",
configure: "node_modules/ink-docstrap/template/jsdoc.conf.json"
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jsdoc');
// Default task(s).
grunt.registerTask('default', ['jshint', 'requirejs:compile']);
grunt.registerTask('document', ['jshint', 'requirejs:compile', 'jsdoc']);
};
{
"name": "some_project_name",
"version": "0.0.1",
"description": "Some project using the ArcGIS JavaScript API",
"author": "Ken Doman",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-requirejs": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-jsdoc": "^1.1.0",
"ink-docstrap": "^1.1.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment