added gulp-header to write metadata in comments of output library #900

This commit is contained in:
Tony Tam
2015-02-02 20:17:00 -08:00
parent f3387b7ded
commit f2f939e24e

View File

@@ -14,19 +14,27 @@ var wrap = require('gulp-wrap');
var declare = require('gulp-declare');
var watch = require('gulp-watch');
var connect = require('gulp-connect');
var header = require('gulp-header');
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
/*
/**
* Clean ups ./dist folder
*/
gulp.task('clean', function() {
return gulp
.src('./dist', {read: false})
.pipe(clean({force: true}))
.on('error', gutil.log);
});
/*
/**
* Processes Handlebars templates
*/
function templates() {
@@ -41,7 +49,7 @@ function templates() {
.on('error', gutil.log);
}
/*
/**
* Processes CoffeeScript files
*/
function coffeescript () {
@@ -51,7 +59,7 @@ function coffeescript () {
.on('error', gutil.log);
}
/*
/**
* Build a distribution
*/
gulp.task('dist', ['clean'], function() {
@@ -62,6 +70,7 @@ gulp.task('dist', ['clean'], function() {
templates()
)
.pipe(concat('swagger-ui.js'))
.pipe(header(banner, { pkg: pkg } ))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
@@ -70,7 +79,7 @@ gulp.task('dist', ['clean'], function() {
.pipe(connect.reload());
});
/*
/**
* Processes less files into CSS files
*/
gulp.task('less', ['clean'], function() {
@@ -87,7 +96,7 @@ gulp.task('less', ['clean'], function() {
});
/*
/**
* Copy lib and html folders
*/
gulp.task('copy', ['less'], function() {
@@ -105,7 +114,7 @@ gulp.task('copy', ['less'], function() {
.on('error', gutil.log)
});
/*
/**
* Watch for changes and recompile
*/
gulp.task('watch', function() {
@@ -114,7 +123,7 @@ gulp.task('watch', function() {
});
});
/*
/**
* Live reload web server of `dist`
*/
gulp.task('connect', function() {