wrap plugin in ;(function (window, $, undefined) { ... })(window, jQuery);, closes #34

This commit is contained in:
t1m0n 2016-03-22 12:03:20 +03:00
parent cbe73255af
commit 0244e14e6f
6 changed files with 15 additions and 9 deletions

View File

@ -19,6 +19,9 @@ $('.my-datepicker').datepicker([options])
## Change log
### v1.2.4
* fixed '$ is not defined' problem.
### v1.2.3
* fixed `dateFormat` method.
* fixed typo in Russian docs, add ids in docs headers.

View File

@ -1,6 +1,6 @@
var Datepicker;
;(function (window, $, undefined) { window.Datepicker = '';
(function (window, $, undefined) {
(function () {
var pluginName = 'datepicker',
autoInitSelector = '.datepicker-here',
$body, $datepickersContainer,
@ -1216,7 +1216,7 @@ var Datepicker;
$(autoInitSelector).datepicker();
})
})(window, jQuery);
})();
;(function () {
var templates = {
days:'' +
@ -1666,3 +1666,4 @@ var Datepicker;
}
})();
})(window, jQuery);

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,7 @@
"gulp-sass": "^2.0.4",
"gulp-uglify": "^1.2.0",
"gulp-watch": "^4.3.5",
"gulp-wrap": "^0.11.0",
"jade": "^1.11.0",
"mocha": "^2.3.4"
}

View File

@ -1,6 +1,6 @@
var Datepicker;
window.Datepicker = '';
(function (window, $, undefined) {
(function () {
var pluginName = 'datepicker',
autoInitSelector = '.datepicker-here',
$body, $datepickersContainer,
@ -1216,4 +1216,4 @@ var Datepicker;
$(autoInitSelector).datepicker();
})
})(window, jQuery);
})();

View File

@ -1,8 +1,8 @@
var gulp = require('gulp'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
clone = require('gulp-clone'),
wrap = require('gulp-wrap'),
concat = require('gulp-concat');
module.exports = function () {
@ -11,7 +11,8 @@ module.exports = function () {
'src/js/body.js',
'src/js/navigation.js'
])
.pipe(concat('datepicker.js'));
.pipe(concat('datepicker.js'))
.pipe(wrap(';(function (window, $, undefined) { <%=contents%> })(window, jQuery);'));
stream.pipe(clone())
.pipe(gulp.dest('dist/js'));