Back

node-webkit(npm)中安装第三方包(如jquery, coffeescript) ( install jquery, coffeescript under node/node-webkit)

发布时间: 2014-07-25 23:21:00

$ 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>

Back