I would like to concat into a single file
plugins.js (out of jQuery function)
fileA.js (jQuery function should start before this file)
fileB.js
...
fileZ.js (jQuery function should end after this file)
At the same time I would like to use jsbeautifier in all those files.
How could I add two "banners" before fileA.js
jQuery(function($){
and after fileZ.js
});
?
Partial solutions I can think of:
a) Add jQuery(function($){ in fileA.js and fileZ.js the corresponding. This forces me to exclude those two files from jsbeautifier which would throw an error. Also I would have to change the function opening/closing if I change the order of fileA.js,etc
b) Include two files that contain the opening/closing where it corresponds
c) Add "banners" in some similar way as this (I have no clue how to actually do something like this)
concat: {
my_script: {
files: {
'myscript.js': [
'plugins.js',
// 'jQuery(function($){',
'fileA.js',
'fileB.js',
// ...
'fileZ.js',
// '});'
],
},
},
},
Edit: I know for this specific case I can use
footer: '})',
however it is only a solution to half of the problem
Is there a better/simplier way of doing this?
a) and b) work but I am asking for a simplier way such as c) that I don't know how to achieve.