| VERSION | = | '1.2.1' |
| are_using_sprockets_3 | [RW] | Indicates whenever we are using Sprockets 3.x. |
| asset_host | [RW] | Link to assets from a dedicated server. |
| debug | [RW] |
When true, force debug mode :debug => true equals
:expand => true :digest => false :manifest => false |
| default_path_options | [W] | |
| digest | [RW] | When true, the asset paths will return digest paths. |
| environment | [RW] | Set the Sprockets environment to search for assets. This defaults to the context‘s environment method. |
| expand | [RW] | When true, expand assets. |
| manifest | [RW] | The manifest file used for lookup |
| prefix | [W] | |
| protocol | [W] | |
| public_path | [W] |
The default options for each asset path method. This is where you can change your default directories for the fallback directory.
The path to the public directory, where the assets not managed by Sprockets will be located. Defaults to ’./public‘
Returns the path to an asset either in the Sprockets environment or the public directory. External URIs are untouched.
For files within Sprockets:
asset_path 'xmlhr.js' # => '/assets/xmlhr.js' asset_path 'xmlhr', :ext => 'js' # => '/assets/xmlhr.js' asset_path 'xmlhr.js', :digest => true # => '/assets/xmlhr-27a8f1f96afd8d4c67a59eb9447f45bd.js' asset_path 'xmlhr.js', :prefix => '/themes' # => '/themes/xmlhr.js'
For files outside of Sprockets:
asset_path 'xmlhr' # => '/xmlhr' asset_path 'xmlhr', :ext => 'js' # => '/xmlhr.js' asset_path 'dir/xmlhr.js', :dir => 'javascripts' # => '/javascripts/dir/xmlhr.js' asset_path '/dir/xmlhr.js', :dir => 'javascripts' # => '/dir/xmlhr.js' asset_path 'http://www.example.com/js/xmlhr' # => 'http://www.example.com/js/xmlhr' asset_path 'http://www.example.com/js/xmlhr.js' # => 'http://www.example.com/js/xmlhr.js'
Computes the path to a audio asset either in the Sprockets environment or the public directory. External URIs are untouched.
With files within Sprockets:
audio_path 'audio.mp3' # => '/assets/audio.mp3' audio_path 'subfolder/audio.mp3' # => '/assets/subfolder/audio.mp3' audio_path '/subfolder/audio.mp3' # => '/assets/subfolder/audio.mp3'
With files outside of Sprockets:
audio_path 'audio' # => '/audios/audio' audio_path 'audio.mp3' # => '/audios/audio.mp3' audio_path 'subfolder/audio.mp3' # => '/audios/subfolder/audio.mp3' audio_path '/subfolder/audio.mp3 # => '/subfolder/audio.mp3' audio_path 'http://www.example.com/img/audio.mp3' # => 'http://www.example.com/img/audio.mp3'
Computes the path to a font asset either in the Sprockets environment or the public directory. External URIs are untouched.
With files within Sprockets:
font_path 'font.ttf' # => '/assets/font.ttf' font_path 'subfolder/font.ttf' # => '/assets/subfolder/font.ttf' font_path '/subfolder/font.ttf' # => '/assets/subfolder/font.ttf'
With files outside of Sprockets:
font_path 'font' # => '/fonts/font' font_path 'font.ttf' # => '/fonts/font.ttf' font_path 'subfolder/font.ttf' # => '/fonts/subfolder/font.ttf' font_path '/subfolder/font.ttf # => '/subfolder/font.ttf' font_path 'http://www.example.com/img/font.ttf' # => 'http://www.example.com/img/font.ttf'
Computes the path to an image asset either in the Sprockets environment or the public directory. External URIs are untouched.
With files within Sprockets:
image_path 'edit.png' # => '/assets/edit.png' image_path 'icons/edit.png' # => '/assets/icons/edit.png' image_path '/icons/edit.png' # => '/assets/icons/edit.png'
With files outside of Sprockets:
image_path 'edit' # => '/images/edit' image_path 'edit.png' # => '/images/edit.png' image_path 'icons/edit.png' # => '/images/icons/edit.png' image_path '/icons/edit.png' # => '/icons/edit.png' image_path 'http://www.example.com/img/edit.png' # => 'http://www.example.com/img/edit.png'
Computes the path to a javascript asset either in the Sprockets environment or the public directory. If the source filename has no extension, .js will be appended. External URIs are untouched.
For files within Sprockets:
javascript_path 'xmlhr' # => '/assets/xmlhr.js' javascript_path 'dir/xmlhr.js' # => '/assets/dir/xmlhr.js' javascript_path '/dir/xmlhr' # => '/assets/dir/xmlhr.js'
For files outside of Sprockets:
javascript_path 'xmlhr' # => '/javascripts/xmlhr.js' javascript_path 'dir/xmlhr.js' # => '/javascripts/dir/xmlhr.js' javascript_path '/dir/xmlhr' # => '/dir/xmlhr.js' javascript_path 'http://www.example.com/js/xmlhr' # => 'http://www.example.com/js/xmlhr' javascript_path 'http://www.example.com/js/xmlhr.js' # => 'http://www.example.com/js/xmlhr.js'
Computes the path to a stylesheet asset either in the Sprockets environment or the public directory. If the source filename has no extension, .css will be appended. External URIs are untouched.
For files within Sprockets:
stylesheet_path 'style' # => '/assets/style.css' stylesheet_path 'dir/style.css' # => '/assets/dir/style.css' stylesheet_path '/dir/style.css' # => '/assets/dir/style.css'
For files outside of Sprockets:
stylesheet_path 'style' # => '/stylesheets/style.css' stylesheet_path 'dir/style.css' # => '/stylesheets/dir/style.css' stylesheet_path '/dir/style.css' # => '/dir/style.css' stylesheet_path 'http://www.example.com/css/style' # => 'http://www.example.com/css/style' stylesheet_path 'http://www.example.com/css/style.css' # => 'http://www.example.com/css/style.css'
Computes the path to a video asset either in the Sprockets environment or the public directory. External URIs are untouched.
With files within Sprockets:
video_path 'video.mp4' # => '/assets/video.mp4' video_path 'subfolder/video.mp4' # => '/assets/subfolder/video.mp4' video_path '/subfolder/video.mp4' # => '/assets/subfolder/video.mp4'
With files outside of Sprockets:
video_path 'video' # => '/videos/video' video_path 'video.mp4' # => '/videos/video.mp4' video_path 'subfolder/video.mp4' # => '/videos/subfolder/video.mp4' video_path '/subfolder/video.mp4 # => '/subfolder/video.mp4' video_path 'http://www.example.com/img/video.mp4' # => 'http://www.example.com/img/video.mp4'
Returns the Sprockets environment asset_path uses to search for assets. This can be overridden for more control, if necessary. Defaults to Sprockets::Helpers.environment or the envrionment returned by environment.