- Set base url
jQuery.use.base = ‘http://example.com’;
- Use a combine file as get args
jQuery.use.combine = true;
- Setup the modules
jQuery.use.modules = {
‘test1’ : { ‘path’: ‘assets/scripts/test1.js’ },
‘test2’ : { ‘path’: ‘assets/scripts/test2.js’, ‘require’: ‘test1’ },
‘test3’ : { ‘path’: ‘assets/scripts/test3.js’, ‘require’: [‘test1’, ‘test2’] },
‘test4’ : { ‘path’: ‘assets/scripts/test4.js’ },
‘test5’ : { ‘path’: ‘assets/scripts/test5.js’, ‘require’: [‘test4’] }
};
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://github.com/m64253/jQuery-use/raw/master/jquery.use.js"></script>
jQuery.use('test1', function($){ console.log('LOADED: "test1"'); });
jQuery.use('test2', function($){ console.log('LOADED: "test2"'); });
jQuery.use('test2', function($){ console.log('LOADED: "test2"'); });
jQuery.use('test3', function($){ console.log('LOADED: "test3"'); });
jQuery.use('test5', function($){ console.log('LOADED: "test5"'); });
jQuery.use(['test3', 'test5'], function($){ console.log('LOADED: "test3, test5"'); });
jQuery.use(function($){ console.log('LOADED: "none"'); });