node-webkit(npm)中安装第三方包(如jquery, coffeescript) ( install jquery, coffeescript under node/node-webkit)
访问量: 5044
$ rm ~/tmp -rf
$ cd <your_project>
$ npm install jquery
$ npm install coffee-script
如何调用? 下面是一个例子:
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
<script>
require('coffee-script/register');
$ = require('jquery');
</script>
</head>
<body>
<h1>Hello World!</h1>
We are using node.js <script>document.write(process.version)</script>.
</body>
<script>
alert($('body h1').html());
</script>
</html>