Skip to content

Commit 34f8134

Browse files
committed
Build/grunt: Update banner template to use task.current.data.src when no file list is given.
1 parent cc3b08d commit 34f8134

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

grunt.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
/*global config:true, task:true*/
2+
function stripDirectory(file) {
3+
return file.replace(/.+\/(.+)$/, '$1');
4+
}
5+
function createBanner(files) {
6+
// strip folders
7+
var fileNames = files && files.map(stripDirectory);
8+
return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
9+
'<%= template.today("isoDate") %>\n' +
10+
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
11+
'* Includes: ' + (files ? fileNames.join(', ') : '<%= stripDirectory(task.current.data.src[1]) %>') + '\n' +
12+
'* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' +
13+
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */';
14+
}
15+
// allow access from banner template
16+
global.stripDirectory = stripDirectory;
17+
218
var coreFiles = 'jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js'.split(', ');
319
var uiFiles = coreFiles.map(function(file) {
420
return 'ui/' + file;
@@ -21,19 +37,6 @@ allI18nFiles.forEach(minFile);
2137
// TODO move core to the front, theme to the end, exclude all and base
2238
var cssFiles = file.expand('themes/base/*.css');
2339

24-
function createBanner(files) {
25-
// strip folders
26-
var fileNames = files && files.map(function(file) {
27-
return file.replace(/.+\/(.+)$/, '$1');
28-
});
29-
return '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
30-
'<%= template.today("isoDate") %>\n' +
31-
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
32-
(files ? '* Includes: ' + fileNames.join(', ') + '\n' : '') +
33-
'* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' +
34-
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */';
35-
}
36-
3740
config.init({
3841
pkg: '<json:package.json>',
3942
meta: {

0 commit comments

Comments
 (0)