diff options
author | Richard Hulse <richard.hulse@radionz.co.nz> | 2011-07-15 16:19:11 +1200 |
---|---|---|
committer | Richard Hulse <richard.hulse@radionz.co.nz> | 2011-07-15 16:19:11 +1200 |
commit | 28d5d22f5a1e3a535d86ad06f4dc8220e61a8d64 (patch) | |
tree | 312485e61a31497c7e87116d6b746a0be4566155 /railties | |
parent | cd8530db3c9930eb3c989ea6ad0cc57fa1821c18 (diff) | |
download | rails-28d5d22f5a1e3a535d86ad06f4dc8220e61a8d64.tar.gz rails-28d5d22f5a1e3a535d86ad06f4dc8220e61a8d64.tar.bz2 rails-28d5d22f5a1e3a535d86ad06f4dc8220e61a8d64.zip |
[asset pipeline] Added information about data uri helper
See Sprockets issue 111
and Sprockets commit cd38a1670a
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/asset_pipeline.textile | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index 522a223c4b..aca3c51db5 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -127,6 +127,15 @@ Alternatively, a file with an MD5 hash after its name such as +public/assets/rai Otherwise, Sprockets will look through the available paths until it finds a file that matches the name and then will serve it, first looking in the application's assets directories and then falling back to the various engines of the application. +If you want to use a "css data uri":http://en.wikipedia.org/wiki/Data_URI_scheme - a method of embedding the image data directly into the CSS file - you can use the +asset_data_uri+ helper. + +<css> + #logo { background: url(<%= asset_data_uri 'logo.png' %>) +</css> + +This will insert a correctly formatted data uri into the CSS source. + + h5. CSS and ERB If you add an erb extension to a css asset: @@ -272,7 +281,7 @@ task :precompile_assets do end </erb> -If you are not precompiling your assets, and you are using the default cache file store (which is the filesystem), you will need to symlink +rails_root/tmp/cache/assets+ from the shared folder that is part of the Capistrano deployment structure. This is so the cached file persist between deployments. +If you are not precompiling your assets, and you are using the default cache file store (which is the filesystem), you will need to symlink +rails_root/tmp/cache/assets+ from the shared folder that is part of the Capistrano deployment structure. This is so the cached file persist between deployments. TODO: Extend above task to allow for this and add task to set it up (See commits 8f0e0b6 and 704ee0df). |