Skip to content Skip to sidebar Skip to footer

Requirejs Worked For One Plug-in, But Not Another

I previously asked this question, and got one plug-in to work. Now, I'm trying to get another plug-in to work using the solution for the first plug-in, but that solution isn't work

Solution 1:

The problem is that, you used path name jquery, but specified jQuery in you Backbones deps:

'Backbone': ['Underscore', 'jQuery'],

Again, here is working example of main.js

index.html

<!doctype html><html><head></head><body><scriptdata-main="main"src="require.js"></script></body></html>

main.js

require.config({
    paths : {
        jquery : 'jquery-2.0.3',
        'rangyinputs-jquery' : 'rangyinputs-jquery-1.1.2',
        textareaAutoExpand: 'js/libs/textarea_auto_expand'
    },
    shim : {
        'rangyinputs-jquery' : {deps : ['jquery'], exports : '$'},
        'textarea_auto_expand': {deps: ['jquery'], exports: '$'}
    }
});


require(['jquery', 'rangyinputs-jquery', 'textarea_auto_expand'], function($) {
    console.log('Type of $.fn.textareaAutoExpand ' + typeof $.fn.textareaAutoExpand );
    var t = $('<textarea/>').textareaAutoExpand();
    $('body').append(t);
});

Post a Comment for "Requirejs Worked For One Plug-in, But Not Another"