diff --git a/gulp/tasks/jshint.js b/gulp/tasks/jshint.js new file mode 100644 index 00000000..c6da7c07 --- /dev/null +++ b/gulp/tasks/jshint.js @@ -0,0 +1,22 @@ +/* + * Paper.js - The Swiss Army Knife of Vector Graphics Scripting. + * http://paperjs.org/ + * + * Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey + * http://scratchdisk.com/ & http://jonathanpuckey.com/ + * + * Distributed under the MIT license. See LICENSE file for details. + * + * All rights reserved. + */ + +var gulp = require('gulp'), + jshint = require('gulp-jshint'), + cache = require('gulp-cached'); + +gulp.task('jshint', function () { + return gulp.src('src/**/*.js') + .pipe(cache('jshint', { optimizeMemory: true })) + .pipe(jshint()) + .pipe(jshint.reporter('jshint-summary')); +}); diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js new file mode 100644 index 00000000..ce138803 --- /dev/null +++ b/gulp/tasks/watch.js @@ -0,0 +1,27 @@ +/* + * Paper.js - The Swiss Army Knife of Vector Graphics Scripting. + * http://paperjs.org/ + * + * Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey + * http://scratchdisk.com/ & http://jonathanpuckey.com/ + * + * Distributed under the MIT license. See LICENSE file for details. + * + * All rights reserved. + */ + +var gulp = require('gulp'), + path = require('path'), + gutil = require('gulp-util'); + + +gulp.task('watch', function () { + gulp.watch('src/**/*.js', ['jshint']) + .on('change', function(event) { + gutil.log( + gutil.colors.green('File ' + event.type + ': ') + + gutil.colors.magenta(path.basename(event.path)) + ); + }); +}); + diff --git a/package.json b/package.json index f7cec5b9..005fa757 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "extend": "^3.0.0", "gitty": "^3.3.3", "gulp": "^3.9.0", + "gulp-cached": "^1.1.0", + "gulp-jshint": "^2.0.0", "gulp-prepro": "^2.0.0", "gulp-qunit": "git://github.com/lehni/gulp-qunit.git#459c5603ceac460327a40dc89df6f19c786dc61b", "gulp-rename": "^1.2.2", @@ -54,6 +56,7 @@ "gulp-whitespace": "^0.1.0", "gulp-zip": "^3.0.2", "jshint": "2.8.x", + "jshint-summary": "^0.4.0", "merge-stream": "^1.0.0", "prepro": "^2.0.0", "qunitjs": "^1.20.0",