欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

How to use YUI2 in YUI3 locally

程序员文章站 2022-04-06 08:25:25
...
1.download YUI3.1.1 and YUI2in3(http://github.com/yui/2in3)
2.include the JS below before the YUI() function

YUI_config = {
groups: {
yui2: {
base: '/2in3/',//the path holding the modules
patterns: {
'yui2-': {
configFn: function(me){
if (/-skin|reset|fonts|grids|base/.test(me.name)) {
me.type = 'css';
me.path = me.path.replace(/\.js/, '.css');
me.path = me.path.replace(/\/yui2-skin/, '/assets/skins/sam/yui2-skin');
}
}
}
}
}
}
}

3.Pass the name of the module as argument to the use function,eg:

YUI().use('yui2-charts', function(Y){//load yui2-charts module
var.YAHOO = Y.YUI2;//you can get YAHOO Instance from the YUI instance
var mychart = new YAHOO.widget.LineChart(...);
});
相关标签: YUI CSS Yahoo