paramquery / select

jQuery select plugin
GNU General Public License v3.0
25 stars 21 forks source link

Requirejs dependencies #11

Closed shmax closed 9 years ago

shmax commented 9 years ago

Hi there, thanks so much for this beautiful widget!

I'm a requirejs user, and I'm struggling to understand how to resolve the jqueryui dependencies you list in your call to define:

if ( typeof define === "function" && define.amd ) {
        define( [
            "jquery",
            "jui/core",
            "jui/widget",
            "jui/position"
        ], factory );
    } else {
        factory( jQuery );
    }

"jquery" is not a problem, but I'm confused about "jui". I installed jqueryui via bower, and I don't have "jui" anywhere in my directory structure. How does one deal with this? Am I required to have that kind of directory structure? Am I supposed to do something with my "paths" setting in my call to requirejs.config? Something with shims?

Any help greatly appreciated.

shmax commented 9 years ago

Closing. I was able to get things working by using the "map" argument of requirejs.config in my gruntfile:

requirejs: {
            compile: {
                options: {
                    name: 'main',
                    baseUrl:'httpdocs/javascript',
                    mainConfigFile:'httpdocs/javascript/main.js',
                    out:'httpdocs/javascript/core.js',
                    map: {
                        "*":{
                            'jui/widget': 'components/jquery-ui/ui/widget',
                            'jui/core': 'components/jquery-ui/ui/core',
                            'jui/position': 'components/jquery-ui/ui/position'
                        }
                    }
                }
            }
        }
paramquery commented 9 years ago

Thanks for sharing the solution.