Skip to content

amikula/asset_types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AssetTypes
==========

Adds asset types to Rails' AssetTagHelper, so you can have different
asset hosts depending on the type of asset.


Example
=======

Set ActionController.asset_hosts as a hash in your environment.rb or
in an initializer:

ActionController::Base.asset_hosts = {'default' => 'http://defaulthost.com', 'alternate' => 'http://alternatehost.com'}

'default' key is used when :asset_type is not specified:
image_tag("foo.jpg") => <img alt='foo.jpg' src='http//defaulthost.com/images/foo.jpg' />

Otherwise, host with the key provided is used:
image_tag("foo.jpg", :asset_type => 'alternate') => <img alt='foo.jpg' src='http//alternatehost.com/images/foo.jpg' />

If the asset_type provided does not match any key in the asset_hosts hash,
the plugin falls back to ActionController::Base.asset_host.

Copyright (c) 2009 Alf Mikula, released under the MIT license

About

Adds asset types to rails' asset helper, so that different asset types can go to different asset hosts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages