Skip to content

Commit

Permalink
Mimic current grunt abilities using gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaas763 committed Mar 2, 2014
1 parent 3a3ec6c commit c683c62
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
36 changes: 36 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var header = require('gulp-header');
var fs = require('fs');
var pkg = require('./package.json');

var paths = {
src: 'src/' + pkg.name + '.js'
};

// Using a banner that is stored in a file to make it easier to work with.
try {
var banner = fs.readFileSync('banner.txt');
} catch(e) {
throw new Error('There was an error reading in the banner.');
}

gulp.task('default', ['build']);

gulp.task('lint', function() {
gulp.src(paths.src)
.pipe(jshint())
.pipe(jshint.reporter('checkstyle'))
.pipe(jshint.reporter('fail'));
});

gulp.task('build', ['lint'], function() {
gulp.src(paths.src)
.pipe(uglify())
.pipe(concat(pkg.name + '.min.js'))
.pipe(header(banner, { pkg: pkg, buildDate: gutil.date(new Date(), 'yyyy-mm-dd') }))
.pipe(gulp.dest('build'));
});
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-jshint": "*"
"grunt-contrib-jshint": "*",
"gulp": "^3.5.5",
"gulp-cached": "0.0.2",
"gulp-changed": "^0.2.1",
"gulp-uglify": "^0.2.1",
"gulp-concat": "^2.1.7",
"gulp-header": "^1.0.2",
"gulp-util": "^2.2.14",
"gulp-jshint": "^1.5.0"
},
"author": "Bill Pullen",
"license": "MIT",
Expand Down

0 comments on commit c683c62

Please sign in to comment.