I have to bundle all my javascript files into one file. This is the requirement. Now I've set up a couple of grunt tasks to concat my javascript files. Scenario:
jquery.js
jquery.plugin1.js
custom.js
>> combined.js
On my development setup I'm using yepnopejs
to load all scripts and excute them on completion. This works fine. All my javascript code works fine except as concatenated file. It seems that jQuery is executed far too early and so some of my selectors don't match the actucal markup.
development
$('input, select').not(':hidden').each(function(){...});
>> length: 21 items
works
production (concated file)
$('input, select').not(':hidden').each(function(){...});
>> length: 0 items
doesn't works.
Initialization
development
yepnope([
{
load: 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'
},
{
load: 'js/jquery.plugin1.js',
complete: function() {
onReady();
}
}]);
production
$(window).load(function(){
onReady();
});
I've tried also $(document).ready(function)
and so on. I'm pretty sure my initialization part is broken or totally wrong.