YUI3 按需加载css文件
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <div id="dialog" title="Basic dialog"> <p>我是一个弹出框</p> </div> <script src="http://yui.yahooapis.com/3.15.0/build/yui/yui-min.js"></script> <script type="text/javascript"> YUI({ groups: { 'local-modules': { base: 'http://ajax.googleapis.com/ajax/libs/', modules: { 'jquery': { path: 'jquery/1.11.0/jquery.min.js' }, 'jquery-ui': { path: 'jqueryui/1.10.4/jquery-ui.min.js', requires: ['jquery', 'jquery-ui-css'] }, 'jquery-ui-css': { path: 'jqueryui/1.10.4/themes/smoothness/jquery-ui.css', type:'css' } } } } }).use('jquery-ui', function(Y) { $(function() { $( "#dialog" ).dialog(); }); }); </script> </body> </html>