LoginSignup
38
39

More than 5 years have passed since last update.

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

Posted at

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アプリが起動しました!らくらくですね!

38
39
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
39