tdreyno / middleman
- Source
- Commits
- Network (4)
- Issues (0)
- Wiki (4)
- Graphs
-
Branch:
master
Project Goals:
The Middleman’s job is watch your template files (Haml, Sass, Erb, Builder, Less & CoffeeScript) for changes and provide a development environment for rapid site creation and prototyping. Some important features are layouts, ruby helpers and the integration of the Compass CSS library. Middleman is built upon Sinatra. In fact, the Middleman config.rb is evaluated within a Sinatra context so anything you could do in Sinatra can be done in Middleman.
The Sinatra Book (http://www.sinatrarb.com/book.html) has some great examples for creating helper functions and changing the router.
The documentation on configuration can be found on the Configuration page.
Installation:
The first step is getting the gem installed. Middleman is on gemcutter’s servers as “middleman.” Assuming your gem setup requires sudo, you can install the official release with the following command.
sudo gem install middleman
Create a Project:
Now that Middleman is installed, you can create a new project using the “mm-init” command which functions much like the “rails” command. Simply pass it a path and a new Middleman project will be generated there.
mm-init new_project_directory
Develop:
To develop against a local server, much like rails’ ./script/server command, change directories into the newly created project folder and run “mm-server.” By default, this command provides a preview server at http://localhost:4567/
mm-server
Middleman comes with a handful of helper methods which those familiar with Rails may find useful: Helpers
You can also run the server through Rack using these instructions: Rack & Heroku
Build Static HTML:
Once you’re done developing and are ready to export to static HTML, make sure you are in the project directory and run the “mm-build” command. This will compile your templates into static HTML and CSS in a build/ folder under your project.
mm-build