1
0
mirror of synced 2024-11-24 22:06:07 +03:00
This will prevent leaking variables, and will remove the possibility
of Select2 not working well with other plugins which support
AMD loaders. The `define` and `require` methods are now aliased
under `$.Select2.amd` for use inside additional files, such as
translations.
This commit is contained in:
Kevin Brown 2014-10-31 20:15:17 -04:00
parent 8e70642b87
commit afbf30d09a
8 changed files with 26 additions and 39 deletions

View File

@ -78,7 +78,8 @@ module.exports = function (grunt) {
paths: { paths: {
almond: '../../vendor/almond-0.2.9', almond: '../../vendor/almond-0.2.9',
jquery: 'jquery.shim' jquery: 'jquery.shim'
} },
wrap: grunt.file.readJSON('src/js/banner.json')
} }
}, },
'dist.full': { 'dist.full': {
@ -91,7 +92,8 @@ module.exports = function (grunt) {
paths: { paths: {
almond: '../../vendor/almond-0.2.9', almond: '../../vendor/almond-0.2.9',
jquery: '../../vendor/jquery-2.1.0' jquery: '../../vendor/jquery-2.1.0'
} },
wrap: grunt.file.readJSON('src/js/banner.json')
} }
}, },
'amd': { 'amd': {
@ -103,7 +105,8 @@ module.exports = function (grunt) {
include: includes, include: includes,
paths: { paths: {
jquery: 'empty:' jquery: 'empty:'
} },
wrap: grunt.file.readJSON('src/js/banner.json')
} }
}, },
'amd.full': { 'amd.full': {
@ -115,30 +118,12 @@ module.exports = function (grunt) {
include: fullIncludes, include: fullIncludes,
paths: { paths: {
jquery: 'empty:' jquery: 'empty:'
} },
wrap: grunt.file.readJSON('src/js/banner.json')
} }
} }
}, },
concat: {
'dist': {
src: [
'src/js/start.js',
'dist/js/select2.js',
'src/js/end.js'
],
dest: 'dist/js/select2.js'
},
'dist.full': {
src: [
'src/js/start.js',
'dist/js/select2.full.js',
'src/js/end.js'
],
dest: 'dist/js/select2.full.js'
}
},
watch: { watch: {
js: { js: {
files: [ files: [
@ -174,7 +159,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['compile', 'test', 'minify']); grunt.registerTask('default', ['compile', 'test', 'minify']);
grunt.registerTask('compile', ['requirejs', 'sass:dev', 'concat']); grunt.registerTask('compile', ['requirejs', 'sass:dev']);
grunt.registerTask('minify', ['uglify', 'sass:dist']); grunt.registerTask('minify', ['uglify', 'sass:dist']);
grunt.registerTask('test', ['qunit', 'jshint']); grunt.registerTask('test', ['qunit', 'jshint']);
}; };

View File

@ -1,4 +1,4 @@
define('select2/utils',[], function () { (function() {define('select2/utils',[], function () {
var Utils = {}; var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) { Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,3 +1674,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

View File

@ -1,4 +1,4 @@
define('select2/utils',[], function () { (function() {define('select2/utils',[], function () {
var Utils = {}; var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) { Utils.Extend = function (ChildClass, SuperClass) {
@ -1674,3 +1674,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());

View File

@ -1,5 +1,4 @@
(function() {/**
/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details * see: http://github.com/jrburke/almond for details
@ -11210,5 +11209,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());
require('jquery.select2');

File diff suppressed because one or more lines are too long

6
dist/js/select2.js vendored
View File

@ -1,5 +1,4 @@
(function() {/**
/**
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details * see: http://github.com/jrburke/almond for details
@ -2103,5 +2102,4 @@ define('jquery.select2',[
return Select2; return Select2;
}); });
require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define };}());
require('jquery.select2');

File diff suppressed because one or more lines are too long

4
src/js/banner.json Normal file
View File

@ -0,0 +1,4 @@
{
"start": "(function() {",
"end": "require('jquery.select2'); $.Select2 = $.Select2 || {}; $.Select2.amd = { define: define, require: require };}());"
}