Last active
March 17, 2016 19:31
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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