I have a Backbone, Marionette and Foundation 5 framework and everything works fine but I can't register Foundation js lib as an AMD module with Require.js. Has anyone successfuly done this? In this example I put just the tooltip component in.
How can I register Foundation 5 as a AMD module with Require.js ?
Here is the code:
require.config({
baseUrl: './js',
paths:{
// Core Libraries
jquery: 'libs/foundation/vendor/jquery',
// foundation 5
modernizr: 'libs/foundation/vendor/modernizr',
tooltip: 'libs/foundation/foundation/foundation.tooltip',
foundation: 'libs/foundation/foundation/foundation'
},
shim:{
// foundation UI framework
tooltip: { deps: ['foundation'] },
foundation: { deps: ['jquery','modernizr'] },
},
});
require(['jquery','backbone','marionette','app/App','foundation','tooltip'],
function ($) {
// Start Marionette Application in desktop mode (default)
App.start();
$(document).foundation();
});
I'm currently looking into this:
http://matznermatzner.de/en/bernd/2013/12/loading-non-amd-modules-requirejs-part-2-zurb-foundation/
It seems that the way Foundation integrates has changed slightly from older versions, which is why updating Foundation in the existing yeoman-foundation generator prevents it from working.
It may be that you're missing the:
{exports: 'Foundation'}
from the shim... will test this out soon!