このリポジトリは Backbone.jsガイドブック の第3章および第7章のサンプルコードを収録しています。
もともとのTodos
リファクタリング後
アプリケーション「Contacts」
テスト
-
Git, npm のインストール
-
Gitリポジトリをローカルマシンにクローンする
% git clone git://github.com/yuku-t/backbone-sample.git % git submodule update --init
-
npmモジュールのインストール
% npm install
合わせてgrunt-cliもインストールします
% npm install -g grunt-cli
-
開発サーバの起動
デフォルトのGruntタスクを実行します。
% grunt Running "connect:server" (connect) task Starting connect web server on localhost:8000. Running "watch" task Waiting...
この状態でブラウザから http://localhost:8000/backbone-sample にアクセスします。 このとき
connect
タスクとwatch
タスクが同時に起動されます。watch
タスクによりJSTファイルとLESSファイルが変更されると自動的にコンパイルされます。 -
ブラウザでテストを実行する
開発サーバを立ち上げた状態で http://localhost:8000/backbone-sample/test/qunit もしくは http://localhost:8000/backbone-sample/test/jasmine にアクセスします。
-
PhantomJSでテストを実行する
test:qunit
とtest:jasmine
の2つのタスクが定義されています。% grunt test:qunit % grunt test:jasmine
-
ビルドする
% grunt build
JavaScriptとCSSをビルドします。
MIT ライセンス