Skip to content

Commit

Permalink
banner
Browse files Browse the repository at this point in the history
  • Loading branch information
progrape committed Oct 26, 2015
1 parent bbe462d commit eabf45a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions dist/swiper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@


var gulp = require('gulp');
var gutil = require('gulp-util');
var header = require('gulp-header');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var less = require('gulp-less');
var autoprefixer = require('gulp-autoprefixer');
var tap = require('gulp-tap');
var browserSync = require('browser-sync');
var config = require('./package.json');
var version = config.version;
var pkg = require('./package.json');

gulp.task('build', ['lint'], function () {
gulp.src('src/example/**/*')
Expand All @@ -26,13 +27,21 @@ gulp.task('build', ['lint'], function () {
.pipe(autoprefixer())
.pipe(gulp.dest('dist'));

var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.repository.url %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.src('src/swiper.js')
.pipe(tap(function(file, t){
var contents = file.contents.toString();
contents = contents.replace('${version}', version);
contents = contents.replace('${version}', pkg.version);
file.contents = new Buffer(contents);
}))
.pipe(uglify())
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist'));
});

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
"browser-sync": "^2.9.11",
"gulp": "~3.8.10",
"gulp-autoprefixer": "^3.1.0",
"gulp-header": "^1.7.1",
"gulp-jshint": "~1.9.0",
"gulp-less": "^3.0.3",
"gulp-rename": "^1.2.2",
"gulp-tap": "^0.1.3",
"gulp-uglify": "^1.0.2"
"gulp-uglify": "^1.0.2",
"gulp-util": "^3.0.7"
}
}

0 comments on commit eabf45a

Please sign in to comment.