mirror of https://github.com/toddmotto/echo.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
var gulp = require('gulp'), |
|
karma = require('gulp-karma'), |
|
jshint = require('gulp-jshint'), |
|
stylish = require('jshint-stylish'), |
|
header = require('gulp-header'), |
|
uglify = require('gulp-uglify'), |
|
plumber = require('gulp-plumber'), |
|
clean = require('gulp-clean'), |
|
rename = require('gulp-rename'), |
|
package = require('./package.json'); |
|
|
|
var paths = { |
|
output : 'dist/', |
|
scripts : [ |
|
'src/echo.js' |
|
], |
|
test: [ |
|
'test/spec/**/*.js' |
|
] |
|
}; |
|
|
|
var banner = [ |
|
'/*! ', |
|
'<%= package.name %> ', |
|
'v<%= package.version %> | ', |
|
'(c) ' + new Date().getFullYear() + ' <%= package.author %> |', |
|
' <%= package.homepage %>', |
|
' */', |
|
'\n' |
|
].join(''); |
|
|
|
gulp.task('scripts', ['clean'], function() { |
|
return gulp.src(paths.scripts) |
|
.pipe(plumber()) |
|
.pipe(header(banner, { package : package })) |
|
.pipe(gulp.dest('dist/')) |
|
.pipe(rename({ suffix: '.min' })) |
|
.pipe(uglify()) |
|
.pipe(header(banner, { package : package })) |
|
.pipe(gulp.dest('dist/')); |
|
}); |
|
|
|
gulp.task('lint', function () { |
|
return gulp.src(paths.scripts) |
|
.pipe(plumber()) |
|
.pipe(jshint()) |
|
.pipe(jshint.reporter('jshint-stylish')); |
|
}); |
|
|
|
gulp.task('clean', function () { |
|
return gulp.src(paths.output, { read: false }) |
|
.pipe(plumber()) |
|
.pipe(clean()); |
|
}); |
|
|
|
gulp.task('test', function() { |
|
return gulp.src(paths.scripts.concat(paths.test)) |
|
.pipe(plumber()) |
|
.pipe(karma({ configFile: 'test/karma.conf.js' })) |
|
.on('error', function(err) { throw err; }); |
|
}); |
|
|
|
gulp.task('default', [ |
|
'lint', |
|
'clean', |
|
'scripts', |
|
'test' |
|
]);
|
|
|