-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mimic current grunt abilities using gulp
- Loading branch information
1 parent
3a3ec6c
commit c683c62
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
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')); | ||
}); |
This file contains 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