Yeoman - scaffold JavaScript Web Application (setup new JavaScript web app quickly)
depend on two tools:
-Grunt, JavaScript task runner
-Bower, A package manager for web
step0, install Node.js and NPM
step1, install Grunt: # npm install -g grunt-cli
step2, install Bower: # npm install -g bower
step3, install Yeoman: # npm -g install yo
step4, install Yeoman generator for Marionette.js: # npm install -g generator-marionette
step5, install Mocha generator(Marionette generator required): # npm install -g generator-mocha-amd
step6, create Marionette Application: javascript
# mkdir webapptest
# cd webapptest
# yo marionette
step7, run application: # gruntjava
備註:web
使用grunt命令時會報錯誤npm
grunt-cli: The grunt command line interface. (v0.1.13) Fatal error: Unable to find local grunt. If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-started
緣由是:Grunt.js 0.4以後,其再也不使用全局方式安裝整個Grunt.js,而是在全局安裝Grunt.js Client,而後在當前項目中安裝Grunt,來避免將來不一樣項目對Grunt不一樣版本的依賴關係。app
step8, 更近一步: # npm install grunt --save-devwebapp
報錯:ide
Loading "Gruntfile.js" tasks...ERROR >> Error: Cannot find module 'grunt-contrib-livereload/lib/utils' Warning: Task "default" not found. Use --force to continue. Aborted due to warnings.
安裝全部依賴:grunt
# npm installui
可以使用Gulp來做爲build tools.this
Reference:
1. http://yeoman.io/generators/ for more generator
2. build tool(Grunt/Gulp), package manager(Bower/npm)
3. 主要參考