mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Build: Update build to UMD wrap widgets, parsers & extras
This commit is contained in:
parent
5df2bcaaa7
commit
9c597cfbba
64
Gruntfile.js
64
Gruntfile.js
@ -32,29 +32,30 @@ module.exports = function( grunt ) {
|
||||
parserSuffix: '.js'
|
||||
},
|
||||
wrapperUMD: {
|
||||
// tablesorter core
|
||||
coreBanner: '(function(factory) {\n' +
|
||||
" if (typeof define === 'function' && define.amd) {\n" +
|
||||
" define(['jquery'], factory);\n" +
|
||||
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
||||
" module.exports = factory(require('jquery'));\n" +
|
||||
' } else {\n' +
|
||||
' factory(jQuery);\n' +
|
||||
' }\n' +
|
||||
'}(function(jQuery) {\n\n',
|
||||
// tablesorter core, widgets & parsers
|
||||
coreBanner: '(function(factory){' +
|
||||
"if (typeof define === 'function' && define.amd){" +
|
||||
"define(['jquery'], factory);" +
|
||||
"} else if (typeof module === 'object' && typeof module.exports === 'object'){" +
|
||||
"module.exports = factory(require('jquery'));" +
|
||||
'} else {' +
|
||||
'factory(jQuery);' +
|
||||
'}' +
|
||||
'}(function(jQuery){\n',
|
||||
// widgets wrapper & combined wrapper - may need a separate entry when this wrapper is redefined to make
|
||||
// widgets a dependency of the core (see https://github.com/Mottie/tablesorter/issues/855)
|
||||
banner: '<%= pkg.banner %>/* Includes widgets ( <%= pkg.selectedWidgets %> <%= pkg.selectedParsers %>) */\n' +
|
||||
'(function(factory) {\n' +
|
||||
" if (typeof define === 'function' && define.amd) {\n" +
|
||||
" define(['jquery'], factory);\n" +
|
||||
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
||||
" module.exports = factory(require('jquery'));\n" +
|
||||
' } else {\n' +
|
||||
' factory(jQuery);\n' +
|
||||
' }\n' +
|
||||
'}(function(jQuery) {\n\n',
|
||||
footer: '\nreturn jQuery.tablesorter;\n}));\n'
|
||||
'(function(factory){' +
|
||||
"if (typeof define === 'function' && define.amd){" +
|
||||
"define(['jquery'], factory);" +
|
||||
"} else if (typeof module === 'object' && typeof module.exports === 'object'){" +
|
||||
"module.exports = factory(require('jquery'));" +
|
||||
'} else {' +
|
||||
'factory(jQuery);' +
|
||||
'}' +
|
||||
'}(function(jQuery) {\n',
|
||||
footer: 'return jQuery.tablesorter;}));\n',
|
||||
footerMain: 'return jQuery;}));\n'
|
||||
},
|
||||
noModBanner: '/*** This file is dynamically generated ***\n' +
|
||||
'█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██\n' +
|
||||
@ -284,6 +285,10 @@ module.exports = function( grunt ) {
|
||||
report: 'gzip'
|
||||
},
|
||||
allFiles: {
|
||||
options: {
|
||||
banner: defaults.wrapperUMD.coreBanner,
|
||||
footer: defaults.wrapperUMD.footerMain
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: './js/', // Src matches are relative to this path.
|
||||
@ -293,7 +298,7 @@ module.exports = function( grunt ) {
|
||||
'!_test-*.js',
|
||||
'!**/_test-*.js',
|
||||
'!*.min.js',
|
||||
'!**/semver.js'
|
||||
'!**/semver*.js',
|
||||
],
|
||||
dest: 'dist/js/',
|
||||
ext: '.min.js', // Dist files will have this extension.
|
||||
@ -313,9 +318,26 @@ module.exports = function( grunt ) {
|
||||
}]
|
||||
},
|
||||
pageraddon: {
|
||||
options: {
|
||||
banner: defaults.wrapperUMD.coreBanner,
|
||||
footer: defaults.wrapperUMD.footerMain
|
||||
},
|
||||
files: {
|
||||
'dist/js/extras/jquery.tablesorter.pager.min.js': [ 'addons/pager/*.js' ]
|
||||
}
|
||||
},
|
||||
// Semver doesn't need a wrapper
|
||||
semver: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: './js/', // Src matches are relative to this path.
|
||||
src: [
|
||||
'**/semver-mod.js',
|
||||
],
|
||||
dest: 'dist/js/',
|
||||
ext: '.min.js', // Dist files will have this extension.
|
||||
extDot: 'last' // Extensions in filenames begin after this dot
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user