weats

在学习了第一章以后基 node.js combohandler自己做了一个简单的功能分享出来

 

上面是我自己的js文件目录

 

这是html代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>图片管家</title>
</head>
<body>

<script src="http://localhost:3000/yui?build/yui/yui-min.js"></script>
<script type="text/javascript">
    YUI({
        comboBase: \'http://localhost:3000/yui?\',
        combine  : true,
        root     : \'build/\',
        groups: {
            \'picture-modules\': {
                async: false,
                comboBase: \'http://localhost:3000/src?\',
                combine  : true,
                root     : \'picture-majordomo/\',
                modules: {
                    \'fn-tip\': {
                        path: \'fn-tip.js?t=201405161050\',
                        requires: [\'node\']
                    },
                    \'login-status\': {
                        path: \'login-status.js?t=201405161050\',
                        requires: [\'json-parse\']
                    },
                    \'picture-uploader\': {
                        path: \'picture-uploader.js?t=201405161050\'
                    }
                }
            }
        }
    }).use(\'fn-tip\', \'login-status\', \'picture-uploader\', function(Y) {
                Y.log("aaa");
            });
</script>
</body>
</html>

 

这是简单的node.js文件

var comboServer = require(\'combohandler/lib/server\'),
    app;

app = comboServer({
    roots: {
        \'/yui\': \'js/library/yui/\',
        \'/src\': \'js/src/\',
        \'/css\': \'css/\'
    }
});

app.listen(3000);

 

运行以后的结果

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-01-04
  • 2022-12-23
  • 2021-09-06
  • 2021-10-24
  • 2022-12-23
猜你喜欢
  • 2021-12-11
  • 2021-11-22
  • 2022-03-10
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案