RequireJS newbie here. Trying to convert some JQuery code I had working fine in the old way to work w/ RequireJS.
Header of my page loads three JS files via script tags
Try using jquery-bridget: https://github.com/desandro/jquery-bridget to convert masonry to a jquery plugin. I created a new js file that gets loaded by requirejs to ensure it is converted before the application starts running:
//masonry-config.js:
'use strict'
define(['jquery-bridget', 'masonry'], function(Bridget, Masonry){
Bridget('masonry', Masonry );
});
Then in my requirejs file
//main.js
require.config({
paths: {
'masonry-config': 'masonry-config'
.....
},
shim: {
'angular-masonry': ['angular', 'masonry'],
'angular' : {
deps: ['imagesloaded', 'masonry-config'],
exports: 'angular'
},
'masonry': ['imagesloaded'],
}
}
This is for my app using angular and angular-masonry (with masonry) so you might need to config a little differently but hopefully that give you some idea.