Usage
Note that there is a Main App and an App2. This is to demonstrate that you can give links relative to the app, but if they are mounted with an extra prefix (using Rack#map, for example) the helper will respect that and produce the right href attribute.
Installation and loading
Start by installing:
gem 'sinatra-exstatic-assets'
Then require it in your Sinatra app.
require 'sinatra/exstatic_assets'
The helpers
Use these helpers in your views.
The code:
Output: The code:
Output: The code:
Output: The code:
Output:stylesheet_tag
stylesheet_tag "/css/screen.css"
javascript_tag
javascript_tag "http://code.jquery.com/jquery-1.9.1.min.js"
image_tag
image_tag "http://farm3.staticflickr.com/2474/3609420787_f7fc0e53c7.jpg", width: "500", height: "375", alt: "Magic Ball"
favicon_tag
favicon_tag