The Base
Static >> The Structure >> The BaseThe base/ directory holds all of the site’s resources, scripts, stylesheets, site-wide partials (including main_navigation.rbml and page_head.rbml as generated by the layout), and the all-important base layout file default.rbml.
The base is the first place consulted when generating sites and pages. If changes are required to a file generated by the layout, it is not a problem. All aspects of the generated site come from the base, the blueprint, and the contents
from the top down
When generating a site all of the information available to each page is passed through base/default.rbml.
Example default.rbml
xhtml :doctype => {:type=>:xhtml, :version=>"1.0", :strict=>false} do
head do
put_title
put_stylesheets
charset 'utf-8'
end
body(:id => 'visible_page') do
div(:id => 'container') do
div(:id => 'header'){
get :base, :page_head
}
div(:id => 'content'){
get :page, :contents
}
div(:id => 'footer'){
get :base, :footer
}
end
end
end
Here you can see a few idioms. :base refers to the place of site-wide available rbml files, while :page refers to the currently processing page. Files may also be addressed via their file name as discussed in the site map section.
However, most important is the line ‘get :page, :contents’ , which gets the blueprint file to be processed for each page.
The Page Head and Main Navigation
Looking into these files we can see the effects of the generator. The page head, in the case of the default layout, consists of an h1 and a call to get :base, :main_navigation while the main navigation has a ul for the main level navigation. Though these were automatically generated, any part of these files may be edited at any time. In this way a site map may be altered and then corrections to menus may be made easily by hand while migrating sites are still a figment of my imagination.
Resources, Stylesheets, Scripts and Other Partials
The base/ is also the gathering place for any non-html resources. Site-wide partials (such as the footer.rbml file) go directly in the base/ directory. Images, movies, and other resources to be used in the site go in the base/resources/ folder. resources is not included in the default layout, but is automatically copied into base/ if included in the chosen layout. The same is true of the scripts/ folder, which has no direct uses at the moment, but should be used to store scripts as you see fit.
Methods for addressing these items are discussed at the end of the content.
All stylesheets used throughout the site should be kept in base/stylesheets and can be included using use_stylesheet or use_stylesheets in the default.rbml or under the stylesheets: key as described in the copy.