39
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

NW.js (node-webkit) の開発をすぐ始める

icon

NW.js (node-webkit) は HTML+CSS+Node.jsでネイティブGUIアプリが作成できる凄いやつです.
githubページを見ると,開発を始めるにはまず本体をダウンロードする必要があるかのような記述ですが・・・

実際は,npmコマンドで始められます!

1. 適当なindex.htmlを作る

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    We are using node.js <script>document.write(process.version)</script>.
  </body>
</html>

2. npm initする

$ npm init
entry point (index.js) <== ここで index.html と答える
$ npm install --save nw

3. nwをインストール

$ npm install --save nw

4. package.jsonの中身に1行追加

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
+   "start": "nw"
  },
  "author": "",
  "license": "ISC"
}

5. 起動

$ npm start

スクリーンショット 2015-02-06 23.25.01.png

これでnw.jsアプリが起動しました!らくらくですね!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
39
Help us understand the problem. What are the problem?