Skip to content

Commit f2f939e

Browse files
committed
added gulp-header to write metadata in comments of output library #900
1 parent f3387b7 commit f2f939e

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

gulpfile.js

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,29 @@ var wrap = require('gulp-wrap');
1414
var declare = require('gulp-declare');
1515
var watch = require('gulp-watch');
1616
var connect = require('gulp-connect');
17-
18-
/*
17+
var header = require('gulp-header');
18+
var pkg = require('./package.json');
19+
var banner = ['/**',
20+
' * <%= pkg.name %> - <%= pkg.description %>',
21+
' * @version v<%= pkg.version %>',
22+
' * @link <%= pkg.homepage %>',
23+
' * @license <%= pkg.license %>',
24+
' */',
25+
''].join('\n');
26+
27+
/**
1928
* Clean ups ./dist folder
20-
*/
29+
*/
2130
gulp.task('clean', function() {
22-
2331
return gulp
2432
.src('./dist', {read: false})
2533
.pipe(clean({force: true}))
2634
.on('error', gutil.log);
2735
});
2836

29-
/*
37+
/**
3038
* Processes Handlebars templates
31-
*/
39+
*/
3240
function templates() {
3341
return gulp
3442
.src(['./src/main/template/**/*'])
@@ -41,19 +49,19 @@ function templates() {
4149
.on('error', gutil.log);
4250
}
4351

44-
/*
52+
/**
4553
* Processes CoffeeScript files
46-
*/
54+
*/
4755
function coffeescript () {
4856
return gulp
4957
.src(['./src/main/coffeescript/**/*.coffee'])
5058
.pipe(coffee({bare: true}))
5159
.on('error', gutil.log);
5260
}
5361

54-
/*
62+
/**
5563
* Build a distribution
56-
*/
64+
*/
5765
gulp.task('dist', ['clean'], function() {
5866

5967
return es.merge(
@@ -62,6 +70,7 @@ gulp.task('dist', ['clean'], function() {
6270
templates()
6371
)
6472
.pipe(concat('swagger-ui.js'))
73+
.pipe(header(banner, { pkg: pkg } ))
6574
.pipe(gulp.dest('./dist'))
6675
.pipe(uglify())
6776
.pipe(rename({extname: '.min.js'}))
@@ -70,9 +79,9 @@ gulp.task('dist', ['clean'], function() {
7079
.pipe(connect.reload());
7180
});
7281

73-
/*
82+
/**
7483
* Processes less files into CSS files
75-
*/
84+
*/
7685
gulp.task('less', ['clean'], function() {
7786

7887
return gulp
@@ -87,9 +96,9 @@ gulp.task('less', ['clean'], function() {
8796
});
8897

8998

90-
/*
99+
/**
91100
* Copy lib and html folders
92-
*/
101+
*/
93102
gulp.task('copy', ['less'], function() {
94103

95104
// copy JavaScript files inside lib folder
@@ -105,18 +114,18 @@ gulp.task('copy', ['less'], function() {
105114
.on('error', gutil.log)
106115
});
107116

108-
/*
117+
/**
109118
* Watch for changes and recompile
110-
*/
119+
*/
111120
gulp.task('watch', function() {
112121
return watch(['./src/**/*.{coffee,js,less}'], function() {
113122
gulp.start('default');
114123
});
115124
});
116125

117-
/*
126+
/**
118127
* Live reload web server of `dist`
119-
*/
128+
*/
120129
gulp.task('connect', function() {
121130
connect.server({
122131
root: 'dist',

0 commit comments

Comments
 (0)