From c21cfb6ed01feb741a893efe6f04259be067aaf5 Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Thu, 2 Apr 2015 02:10:25 +0900 Subject: [PATCH] Add version information to built files. --- gulpfile.js | 7 +++++++ package.json | 1 + 2 files changed, 8 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index a630ba6..cb16e3a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,6 +5,7 @@ var gulp = require('gulp') , bump = require('gulp-bump') , connect = require('gulp-connect') , eslint = require('gulp-eslint') + , insert = require('gulp-insert') , rename = require('gulp-rename') , rimraf = require('gulp-rimraf') , sass = require('gulp-sass') @@ -12,6 +13,8 @@ var gulp = require('gulp') , uglify = require('gulp-uglify') , zip = require('gulp-zip'); +var version = '/* perfect-scrollbar v' + require('./package').version + ' */\n'; + gulp.task('lint', function () { return gulp.src(['./src/**/*.js', './gulpfile.js']) .pipe(eslint()) @@ -39,6 +42,7 @@ function browserified() { gulp.task('js', ['clean:js'], function () { return gulp.src('./src/js/adaptor/*.js') .pipe(browserified()) + .pipe(insert.prepend(version)) .pipe(rename(function (path) { if (path.basename === 'global') { path.basename = 'perfect-scrollbar'; @@ -54,6 +58,7 @@ gulp.task('js:min', ['clean:js:min'], function () { return gulp.src('./src/js/adaptor/*.js') .pipe(browserified()) .pipe(uglify()) + .pipe(insert.prepend(version)) .pipe(rename(function (path) { if (path.basename === 'global') { path.basename = 'perfect-scrollbar.min'; @@ -77,6 +82,7 @@ gulp.task('clean:css:min', function () { gulp.task('sass', ['clean:css'], function () { return gulp.src('./src/css/main.scss') .pipe(sass()) + .pipe(insert.prepend(version)) .pipe(rename('perfect-scrollbar.css')) .pipe(gulp.dest('./dist/css')) .pipe(connect.reload()); @@ -85,6 +91,7 @@ gulp.task('sass', ['clean:css'], function () { gulp.task('sass:min', ['clean:css:min'], function () { return gulp.src('./src/css/main.scss') .pipe(sass({outputStyle: 'compressed'})) + .pipe(insert.prepend(version)) .pipe(rename('perfect-scrollbar.min.css')) .pipe(gulp.dest('./dist/css')); }); diff --git a/package.json b/package.json index f7f39ea..535a2fd 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "gulp-bump": "^0.1.11", "gulp-connect": "^2.2.0", "gulp-eslint": "^0.2.0", + "gulp-insert": "^0.4.0", "gulp-rename": "^1.2.0", "gulp-rimraf": "^0.1.1", "gulp-sass": "^1.3.1",