Creating a New Serve Project

For simple projects, you don’t need to structure your files in a specific way. All ERB, Haml, and Sass files will be processed wherever they are found in the project root. But for more complex projects you may want to use Serve with a `config.ru` file so that you can take advantage of other Rack middleware and structure the project in a Rack compatible way.

To create a new Rack-based Serve project in the "project" directory, type the following on the command line:

serve create project   # create a new project in the project directory

This will create a new project with the following directory structure:

project/
  |
  +-- config.ru              # Rack configuration file
  |
  +-- compass.config         # Compass configuration file
  |
  +-- public/                # Directories for static assets
  |    |
  |    +-- stylesheets/      # Compiled stylesheets
  |    |
  |    +-- images/
  |    |
  |    `-- javascripts/
  |
  +-- stylesheets/           # Sass and SCSS source files
  |    |
  |    `-- application.scss  # Example SCSS file for application
  |
  +-- tmp/                   # Needed for Passenger (mod_passenger)
  |    |
  |    `-- restart.txt
  |
  `-- views/                 # Store your ERB, Haml, etc. here

If you would like to generate the project with a specific JavaScript framework you can do so with the -j flag:

serve create my-project -j prototype

Available frameworks are: jquery, jquery-ui, mootools, prototype, and scriptaculous.

You can also specify a "template" to base your Serve project on with the -t flag.

serve create my-project -t blank

A template can be one of the built-in templates (blank or default), or a directory of your choosing. Files in the template directory will overwrite the base files needed for an install.

The serve create command can be executed multiple times or on an existing project without negative consequences.