Skip to content
프로젝트

소개

Serve는 웹 애플리케이션(특히 Rails 앱)을 위한 작고 Rack 기반인 웹 서버이자 신속한 프로토타이핑 프레임워크입니다. Rails MVC의 뷰 부분을 가볍게 구현한 것을 목표로 합니다. 따라서 Rails 애플리케이션의 프로토타입을 만들거나 간단한 웹사이트를 제작하는 데 적합합니다. Rails 스타일의 부분 템플릿과 레이아웃을 완전히 지원합니다.

시스템 및 인프라

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Serve is a small Rack-based web server that makes it easy to serve HTML, ERB, Haml, or a variety of template languages from any directory.

Serve is meant to be a lightweight version of the Views part of the Rails MVC. This makes Serve an ideal framework for prototyping Rails applications or creating simple websites. Serve has full support for Rails-style partials and layouts.

Serve is made with Rack & Tilt.

Serve is distributed as a Ruby gem and can be installed from the command prompt. Just type:

gem install serve -v 1.5.2

Some systems, like the Mac, may require that you type:

sudo gem install serve -v 1.5.2

If you are new to the command prompt and are a Mac user see:

wiseheartdesign.com/articles/2010/11/12/the-designers-guide-to-the-osx-command-prompt/

Search Google for “command prompt windows” if you are on a PC to find a simple tutorial.

Once the gem is installed the serve command will be available from the command prompt. To launch Serve, just type the command and press enter:

serve

This will launch a simple web server which you can access from any web browser at the following address:

http://localhost:4000

Once the server is going it will output a running log of its activity. To stop the server at any time, type CTRL+C at the command prompt.

Learn more: get-serve.com/documentation/usage

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 add a bit of structure.

To create a structured Serve project in the “project” directory, type the following on the command line:

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

Learn more: get-serve.com/documentation/create

Serve has full support for Rails-style layouts and partials.

Serve layouts are stored in “_layout.erb” or “_layout.haml” files in the same directory as the page they are rendering.

Learn more: get-serve.com/documentation/layouts

Serve partials (much like PHP includes) are rendered using the familiar render syntax:

<%= render "footer" %>

Learn more: get-serve.com/documentation/partials

If you drop a file called “view_helpers.rb” in your views directory, you can define custom helpers for your Haml and ERB views. Just create a ViewHelpers module and define your custom helper methods there:

module ViewHelpers

  # Calculate the years for a copyright
  def copyright_years(start_year)
    end_year = Date.today.year
    if start_year == end_year
      start_year
    else
      start_year.to_s + "&#8211;" + end_year.to_s
    end
  end

end

You can then use your custom helper methods inside a view or layout:

<%= copyright_years(2010) %>

Serve also provides a number of stock helpers methods that are very similar to their Rails counter parts.

Learn more: get-serve.com/documentation/view-helpers

To export your project, use the new “export” command:

serve export project output

Where “project” is the path to the project and “output” is the path to the directory where you would like your HTML and CSS generated.

Learn more: get-serve.com/documentation/export

If you use a “Design First” methodology, you may find Serve especially useful for prototyping your applications. Create a separate “prototype” project for your application (using Serve) and copy views over into actual application when they are ready to go. This workflow allows the designer to focus on presentation and flow, while the developer can focuses on implementation. One benefit to this approach is that the designer can identify and fix a large number of design-related problems before a feature is ever touched by the developer. Once a feature has been completed in the prototype project it can also be estimated with a high degree of accuracy.

Detailed documentation is available on the Serve website: get-serve.com Build status: <img src=“https://secure.travis-ci.org/jlong/serve.png?branch=master” />

Have questions? Please don’t be ashamed to ask. Post them on the mailing list:

groups.google.com/group/serve-users

  • We are working on a new website for serve, with a new minimal design, estimated to be released in late Augest 2015.

Serve is released under a MIT-style license and is copyright © 2007-2011 John W. Long and Adam I. Williams. Portions have been contributed by Robert Evans and others. A copy of the license can be found in the LICENSE file.

관련 프로젝트 살펴보기

불러오는 중…