A generator for Yeoman.
From the default Yeoman Generator:
Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
To install Yeoman you will need to have npm (node packaged modules) installed. It comes with Node. You can install Node by using the downloader or through Brew. I like Brew. If you use Brew you'll need to add this to your .bash_profile.
Here is a post on installing Node if you need it.
Once Node is installed you'll have access to npm so you can use this to install Yeoman.
npm install -g yo
The -g means that you are installing Yeoman globally. If you wish to uninstall Yeoman you can do so with this command.
npm uninstall -g yo
This generator uses some tools I find useful. Those include:
With Node and npm installed run this to install.
npm install -g generator-node-express
With the generator installed it is time to run it. Create a directory on your computer somewhere and cd into it via the terminal. Then run:
Yeoman will ask you some questions. Answer them and it will install stuff based on your answers.
Once Yeoman is done setting up your project run this command to start working on it.
This starts the server, launches the project in your editor, opens the project in a browser, and starts watching the project for changes.
To enable LiveRelaod you'll need to install the Chrome extension.
Once installed and the project is running just turn on the Chrome Extension.
When you edit files that need the server to restart for you to see the changes, most of the time Grunt will just restart it for you. There are times when it gets stuck though. If this happens you can run this command to start it back up without reopening the project in your editor and browser.
$ grunt restart
Once your app is ready for production run this to generate a production build of your project.
To test to see if the app is using the production version of the app you can shut down the server and start it again in production mode.
$ NODE_ENV=production node app.js
If it all works you are ready to deploy to Heroku. The Procfile at the root directory is for Heroku. Without it Heroku will choke. To deploy to Heroku you will need a Heorku account and the Heroku Toolbelt installed.
Once that is setup use Git to commit and then Heroku to create and deploy.
git init git add . git commit -m 'init'
Create the app
Deploy your code
git push heroku master
To ensure that Heroku is setup to use your production settings you'll need to run this:
heroku config:set NODE_ENV=production
Open the project