This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
README.md
Rack::StaticAssets
The intent is to better define the static resources a page requires and eliminate unnecessary javascript/css inclusions with a centralized declaration and an abstracted implementation (via Rack middleware).
Declarations
The resources a page requires are defined in a central file called static_assets.rb. The directory this file resides in is determined by:
Rack::StaticAssets.config_directory = './config' # default
You can define a grouping of files as:
script_bundle(:jquery).with('jquery.js', 'jquery-ui.js')
style_bundle(:base_style).with('reset.css', 'site.css')
You can build on a bundle:
# Use the :jquery definition above and add 'carousel.js'
script_bundle(:detail).with(:jquery, 'carousel.js')
Apply a bundle to a page:
# Everything under blog gets one script tag and one stylesheet link tag
# which is a combination of the above files
map(:jquery, :base_style).to('/blog/*')
# Chain the same bundle to multiple paths
map(:jquery, :base_style).to('/blog/*').and('/posts/*')
# Apply a bundle to all paths
map(:base_style).to(:all)
Disclaimer
This is just an idea right now...but I think it sounds good. Once I get to the implementation details some/all of the above may change.








