Home > OProto

OProto

OProto is a project mainly written in JAVASCRIPT and RUBY, it's free.

Starter repository for creating static sites for the purpose of prototyping. Uses Rails with StaticMatic, Haml, Sass and includes various Javascript libraries.

OProto uses the best open source tools to make static web development as fast as possible.

OProto is a barebones skeleton of a basic website for the purpose of bootstrapping a static website or prototype an application. OProto uses a range of web development frameworks to speed up the process of creating static websites, namely bootstrapping, managing pages, partials, states and styles.

Problems addressed by OProto

Template and Content Management

Experienced front-end developers can do a lot by hand very quickly. We're smart enough to know that markup and content should be as DRY as possible. Sharing common page elements like headers and footers as included templates makes a lot of sense but can quickly get messy when you want to pass variables around, use a slightly different template for one page but not another, and can also just be a chore to set-up. Also, having local paths ending in .html or .php is just… embarrassing.

OProto uses StaticMatic to alleviate all of these symptoms. An additional dose of Haml makes marking up a document simple and fun again. Side effects include glee, bliss and a rapidly-developing sense of productivity.

We've taken some cues from Paul Irish & Co's fantastic HTML5 boilerplate and integrated it into the starter template files.

CSS is too dumb to be productive

Lorin Tacket nails it: CSS is a stupid language. That is, while its certainly the best way to style web content, it lacks some of the basic features of a scripting language most developers are used to: variables, basic functions and simple math. This means that creating CSS from scratch is inevitably a slow process.

Sass provides all these features and more: nesting, mixins (think of snippets of CSS as plugins), inheritance, and a more simplistic syntax. StaticMatic runs the Sass watcher on your stylesheets directory and compiles pure CSS every time you save a change.

Finally, Compass provides ports of CSS frameworks (and allows you to roll your own) like Blueprint, which takes the hard work out of accomplishing tasks like creating a layout grid. Its CSS3 helper might very well be the only way to use vendor-specific CSS3 properties without feeling like your repeating yourself repeating yourself. Impress your friends as one line of

.crazy
  +border-radius(1px 3px 5px 7px)

magically becomes

.crazy {
 -webkit-border-radius: 1px 3px 5px 7px;
 -moz-border-radius: 1px 3px 5px 7px;
 -o-border-radius: 1px 3px 5px 7px;
 -ms-border-radius: 1px 3px 5px 7px;
 -khtml-border-radius: 1px 3px 5px 7px;
 border-radius: 1px 3px 5px 7px; }

in the blink of an eye!

Full Technology Overview

  • Ruby on Rails - That thing you heard about
  • StaticMatic - Static websites, the modern way
  • Compass - Compass provides ports of the best of breed css frameworks that you can use without forcing you to use their presentational class names.
  • Haml - Lean, poetic markup
  • Sass - Super sexy css
  • Blueprint - Blueprint gives you a solid foundation to build your project on top of, with an easy-to-use grid, sensible typography, useful plugins, and even a stylesheet for printing.
  • Fancy Buttons - Fancy CSS Buttons
  • jQuery - Our Savior

Getting Started with OProto

Assuming you have Git, Rails and Ruby Gems (staticmatic should take care of haml/sass, compass)…

$ gem install fancy-buttons
$ gem install staticmatic --pre

… clone this project…

$ git clone git://github.com/ericdfields/OProto.git my_project_name

… and run staticmatic on your project

$ staticmatic preview my_project_name

This will launch a web server for you to preview your site at http://localhost:3000. To kill the server, simply hit ctrl+C.

OProto Source Overview

This is what you just checked out:

  • config - a few configuration files.
  • site - mostly where your output files will live if you choose to export your project
    • images - image resources
    • javascripts - Javascript resources
    • stylesheets - stylesheet resources
  • src - where you'll do all your real work
    • helpers - [http://staticmatic.rubyforge.org/helper_central/](StaticMatic Helpers)
    • layouts - base templates for your pages
    • pages - individual page content, inherits a template, haml-formatted
    • partials - reusable blocks of code used in both pages and layouts
    • stylesheets - sass-formatted stylesheets

Templating with OProto

Creating pages for your site with OProto is as simple as adding a new haml file to the src/pages directory. index.haml will live at /. special.haml will live at /special. special/event.haml will live at /special/event.

By default, all pages use the layouts/application.haml layout template. You can use custom layouts by defining the @layout variable at the top of your page. For example, in special.haml:

- @layout = "special"

/special now uses the layout template layouts/special.haml.

Similarly, you can set up variables in your layout templates or partials and define them in a page:

- @pageTitle = "Special Event Page Title"
- @h2 = "Special Event Headline"
- @h3 = "Special Event Subheadline"

Will help us set the tag value, headline, and subheadline found elsewhere in the template tree.</p> <h2>Styling with OProto</h2> <p>The stylesheets directory breaks up your documents styles into a few different stylesheets for ease of development.</p> <h3>_base.sass</h3> <p><strong>_base</strong> is the mothership of the OProto styling operation. Use her to do any of the following:</p> <ul> <li>define style variables that can be used throughout <em>all</em> of your stylesheets</li> <li>set up your base fonts</li> <li>set up your grids</li> <li>manage Compass imports</li> </ul> <h3>screen.sass et. al.</h3> <p><strong>screen</strong> is where most of your display styles should go, with the exception of</p> <ul> <li>typography.sass - set up your meticulously-defined typographic rules here</li> <li>forms.sass - standardize the look and feel of your forms here</li> <li>print.sass - do your papery styles here</li> <li>ie6.sass - lest we forget</li> </ul> <h1>Roadmap</h1> <p>OProto is evolving as we continue to test it in internally.</p> <h2>Next up</h2> <ul> <li>partials for widgets (slideshow, drop downs, etc)</li> <li>more templates (common product page, web app, etc)?</li> </ul> <h1>Fin</h1> <p>Created by Eric D. Fields, Senior UX Developer at Optaros</p> <p>Copyright Optaros</p> <p>Dual licensed under MIT and GPL</p> </div> </div> </div> <div class="col-sm-10 col-sm-offset-1" style="margin-top: 1px;"> <div class="listBlocks content_box"> <div class="pre_next_box"> <div class="pre_next"><div class="pre"><span>Previous:</span><a href="//osphub.com/hermes1d-llnl/" title="hermes1d-llnl">hermes1d-llnl</a></div><div class="next"><span>Next:</span><a href="//osphub.com/soldoku/" title="soldoku">soldoku</a></div></div> </div> </div> </div> </div> <!-- <div class="simle_box300"></div> --> </div> </section> <div class="footer-wrapper"> <div class="footer"> <p class="text-center"> ©2024 OSPHUB.COM </p> </div> </div></body> </html>