Implement adaptors.

This commit is contained in:
Hyunje Alex Jun 2015-01-26 15:01:07 +00:00
parent 6f5a9088aa
commit ee455fafa5
3 changed files with 25 additions and 9 deletions

View File

@ -19,12 +19,12 @@ gulp.task('lint', function () {
}); });
gulp.task('clean:js', function () { gulp.task('clean:js', function () {
return gulp.src('./out/js/perfect-scrollbar.js', {read: false}) return gulp.src('./out/js/*.js', {read: false})
.pipe(rimraf()); .pipe(rimraf());
}); });
gulp.task('clean:js:min', function () { gulp.task('clean:js:min', function () {
return gulp.src('./out/js/perfect-scrollbar.min.js', {read: false}) return gulp.src('./out/js/min/*.js', {read: false})
.pipe(rimraf()); .pipe(rimraf());
}); });
@ -36,19 +36,24 @@ function browserified() {
} }
gulp.task('js', ['clean:js'], function () { gulp.task('js', ['clean:js'], function () {
return gulp.src('./src/js/main.js') return gulp.src('./src/js/adaptor/*.js')
.pipe(browserified()) .pipe(browserified())
.pipe(rename('perfect-scrollbar.js')) .pipe(rename({
prefix: 'perfect-scrollbar.'
}))
.pipe(gulp.dest('./out/js')) .pipe(gulp.dest('./out/js'))
.pipe(connect.reload()); .pipe(connect.reload());
}); });
gulp.task('js:min', ['clean:js:min'], function () { gulp.task('js:min', ['clean:js:min'], function () {
return gulp.src('./src/js/main.js') return gulp.src('./src/js/adaptor/*.js')
.pipe(browserified()) .pipe(browserified())
.pipe(uglify()) .pipe(uglify())
.pipe(rename('perfect-scrollbar.min.js')) .pipe(rename({
.pipe(gulp.dest('./out/js')); prefix: 'perfect-scrollbar.',
suffix: '.min'
}))
.pipe(gulp.dest('./out/js/min'));
}); });
gulp.task('clean:css', function () { gulp.task('clean:css', function () {

11
src/js/adaptor/global.js Normal file
View File

@ -0,0 +1,11 @@
/* Copyright (c) 2015 Hyunje Alex Jun and other contributors
* Licensed under the MIT License
*/
'use strict';
var ps = require('../plugin/ps');
window.PerfectScrollbar = ps;
if (typeof window.Ps === 'undefined') {
window.Ps = ps;
}

View File

@ -3,8 +3,8 @@
*/ */
'use strict'; 'use strict';
var ps = require('./plugin/ps') var ps = require('../plugin/ps')
, psInstances = require('./plugin/instances'); , psInstances = require('../plugin/instances');
$.fn.perfectScrollbar = function (settingOrCommand) { $.fn.perfectScrollbar = function (settingOrCommand) {
return this.each(function () { return this.each(function () {