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'
|
parserSuffix: '.js'
|
||||||
},
|
},
|
||||||
wrapperUMD: {
|
wrapperUMD: {
|
||||||
// tablesorter core
|
// tablesorter core, widgets & parsers
|
||||||
coreBanner: '(function(factory) {\n' +
|
coreBanner: '(function(factory){' +
|
||||||
" if (typeof define === 'function' && define.amd) {\n" +
|
"if (typeof define === 'function' && define.amd){" +
|
||||||
" define(['jquery'], factory);\n" +
|
"define(['jquery'], factory);" +
|
||||||
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
"} else if (typeof module === 'object' && typeof module.exports === 'object'){" +
|
||||||
" module.exports = factory(require('jquery'));\n" +
|
"module.exports = factory(require('jquery'));" +
|
||||||
' } else {\n' +
|
'} else {' +
|
||||||
' factory(jQuery);\n' +
|
'factory(jQuery);' +
|
||||||
' }\n' +
|
'}' +
|
||||||
'}(function(jQuery) {\n\n',
|
'}(function(jQuery){\n',
|
||||||
// widgets wrapper & combined wrapper - may need a separate entry when this wrapper is redefined to make
|
// 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)
|
// widgets a dependency of the core (see https://github.com/Mottie/tablesorter/issues/855)
|
||||||
banner: '<%= pkg.banner %>/* Includes widgets ( <%= pkg.selectedWidgets %> <%= pkg.selectedParsers %>) */\n' +
|
banner: '<%= pkg.banner %>/* Includes widgets ( <%= pkg.selectedWidgets %> <%= pkg.selectedParsers %>) */\n' +
|
||||||
'(function(factory) {\n' +
|
'(function(factory){' +
|
||||||
" if (typeof define === 'function' && define.amd) {\n" +
|
"if (typeof define === 'function' && define.amd){" +
|
||||||
" define(['jquery'], factory);\n" +
|
"define(['jquery'], factory);" +
|
||||||
" } else if (typeof module === 'object' && typeof module.exports === 'object') {\n" +
|
"} else if (typeof module === 'object' && typeof module.exports === 'object'){" +
|
||||||
" module.exports = factory(require('jquery'));\n" +
|
"module.exports = factory(require('jquery'));" +
|
||||||
' } else {\n' +
|
'} else {' +
|
||||||
' factory(jQuery);\n' +
|
'factory(jQuery);' +
|
||||||
' }\n' +
|
'}' +
|
||||||
'}(function(jQuery) {\n\n',
|
'}(function(jQuery) {\n',
|
||||||
footer: '\nreturn jQuery.tablesorter;\n}));\n'
|
footer: 'return jQuery.tablesorter;}));\n',
|
||||||
|
footerMain: 'return jQuery;}));\n'
|
||||||
},
|
},
|
||||||
noModBanner: '/*** This file is dynamically generated ***\n' +
|
noModBanner: '/*** This file is dynamically generated ***\n' +
|
||||||
'█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██\n' +
|
'█████▄ ▄████▄ █████▄ ▄████▄ ██████ ███████▄ ▄████▄ █████▄ ██ ██████ ██ ██\n' +
|
||||||
@ -284,6 +285,10 @@ module.exports = function( grunt ) {
|
|||||||
report: 'gzip'
|
report: 'gzip'
|
||||||
},
|
},
|
||||||
allFiles: {
|
allFiles: {
|
||||||
|
options: {
|
||||||
|
banner: defaults.wrapperUMD.coreBanner,
|
||||||
|
footer: defaults.wrapperUMD.footerMain
|
||||||
|
},
|
||||||
files: [{
|
files: [{
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: './js/', // Src matches are relative to this path.
|
cwd: './js/', // Src matches are relative to this path.
|
||||||
@ -293,7 +298,7 @@ module.exports = function( grunt ) {
|
|||||||
'!_test-*.js',
|
'!_test-*.js',
|
||||||
'!**/_test-*.js',
|
'!**/_test-*.js',
|
||||||
'!*.min.js',
|
'!*.min.js',
|
||||||
'!**/semver.js'
|
'!**/semver*.js',
|
||||||
],
|
],
|
||||||
dest: 'dist/js/',
|
dest: 'dist/js/',
|
||||||
ext: '.min.js', // Dist files will have this extension.
|
ext: '.min.js', // Dist files will have this extension.
|
||||||
@ -313,9 +318,26 @@ module.exports = function( grunt ) {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
pageraddon: {
|
pageraddon: {
|
||||||
|
options: {
|
||||||
|
banner: defaults.wrapperUMD.coreBanner,
|
||||||
|
footer: defaults.wrapperUMD.footerMain
|
||||||
|
},
|
||||||
files: {
|
files: {
|
||||||
'dist/js/extras/jquery.tablesorter.pager.min.js': [ 'addons/pager/*.js' ]
|
'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