Add version information to built files.
This commit is contained in:
parent
e4b21c7069
commit
c21cfb6ed0
@ -5,6 +5,7 @@ var gulp = require('gulp')
|
|||||||
, bump = require('gulp-bump')
|
, bump = require('gulp-bump')
|
||||||
, connect = require('gulp-connect')
|
, connect = require('gulp-connect')
|
||||||
, eslint = require('gulp-eslint')
|
, eslint = require('gulp-eslint')
|
||||||
|
, insert = require('gulp-insert')
|
||||||
, rename = require('gulp-rename')
|
, rename = require('gulp-rename')
|
||||||
, rimraf = require('gulp-rimraf')
|
, rimraf = require('gulp-rimraf')
|
||||||
, sass = require('gulp-sass')
|
, sass = require('gulp-sass')
|
||||||
@ -12,6 +13,8 @@ var gulp = require('gulp')
|
|||||||
, uglify = require('gulp-uglify')
|
, uglify = require('gulp-uglify')
|
||||||
, zip = require('gulp-zip');
|
, zip = require('gulp-zip');
|
||||||
|
|
||||||
|
var version = '/* perfect-scrollbar v' + require('./package').version + ' */\n';
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
return gulp.src(['./src/**/*.js', './gulpfile.js'])
|
return gulp.src(['./src/**/*.js', './gulpfile.js'])
|
||||||
.pipe(eslint())
|
.pipe(eslint())
|
||||||
@ -39,6 +42,7 @@ function browserified() {
|
|||||||
gulp.task('js', ['clean:js'], function () {
|
gulp.task('js', ['clean:js'], function () {
|
||||||
return gulp.src('./src/js/adaptor/*.js')
|
return gulp.src('./src/js/adaptor/*.js')
|
||||||
.pipe(browserified())
|
.pipe(browserified())
|
||||||
|
.pipe(insert.prepend(version))
|
||||||
.pipe(rename(function (path) {
|
.pipe(rename(function (path) {
|
||||||
if (path.basename === 'global') {
|
if (path.basename === 'global') {
|
||||||
path.basename = 'perfect-scrollbar';
|
path.basename = 'perfect-scrollbar';
|
||||||
@ -54,6 +58,7 @@ gulp.task('js:min', ['clean:js:min'], function () {
|
|||||||
return gulp.src('./src/js/adaptor/*.js')
|
return gulp.src('./src/js/adaptor/*.js')
|
||||||
.pipe(browserified())
|
.pipe(browserified())
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
|
.pipe(insert.prepend(version))
|
||||||
.pipe(rename(function (path) {
|
.pipe(rename(function (path) {
|
||||||
if (path.basename === 'global') {
|
if (path.basename === 'global') {
|
||||||
path.basename = 'perfect-scrollbar.min';
|
path.basename = 'perfect-scrollbar.min';
|
||||||
@ -77,6 +82,7 @@ gulp.task('clean:css:min', function () {
|
|||||||
gulp.task('sass', ['clean:css'], function () {
|
gulp.task('sass', ['clean:css'], function () {
|
||||||
return gulp.src('./src/css/main.scss')
|
return gulp.src('./src/css/main.scss')
|
||||||
.pipe(sass())
|
.pipe(sass())
|
||||||
|
.pipe(insert.prepend(version))
|
||||||
.pipe(rename('perfect-scrollbar.css'))
|
.pipe(rename('perfect-scrollbar.css'))
|
||||||
.pipe(gulp.dest('./dist/css'))
|
.pipe(gulp.dest('./dist/css'))
|
||||||
.pipe(connect.reload());
|
.pipe(connect.reload());
|
||||||
@ -85,6 +91,7 @@ gulp.task('sass', ['clean:css'], function () {
|
|||||||
gulp.task('sass:min', ['clean:css:min'], function () {
|
gulp.task('sass:min', ['clean:css:min'], function () {
|
||||||
return gulp.src('./src/css/main.scss')
|
return gulp.src('./src/css/main.scss')
|
||||||
.pipe(sass({outputStyle: 'compressed'}))
|
.pipe(sass({outputStyle: 'compressed'}))
|
||||||
|
.pipe(insert.prepend(version))
|
||||||
.pipe(rename('perfect-scrollbar.min.css'))
|
.pipe(rename('perfect-scrollbar.min.css'))
|
||||||
.pipe(gulp.dest('./dist/css'));
|
.pipe(gulp.dest('./dist/css'));
|
||||||
});
|
});
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
"gulp-bump": "^0.1.11",
|
"gulp-bump": "^0.1.11",
|
||||||
"gulp-connect": "^2.2.0",
|
"gulp-connect": "^2.2.0",
|
||||||
"gulp-eslint": "^0.2.0",
|
"gulp-eslint": "^0.2.0",
|
||||||
|
"gulp-insert": "^0.4.0",
|
||||||
"gulp-rename": "^1.2.0",
|
"gulp-rename": "^1.2.0",
|
||||||
"gulp-rimraf": "^0.1.1",
|
"gulp-rimraf": "^0.1.1",
|
||||||
"gulp-sass": "^1.3.1",
|
"gulp-sass": "^1.3.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user