diff options
author | Richard Hulse <richard.hulse@radionz.co.nz> | 2011-09-01 21:20:26 +1200 |
---|---|---|
committer | Richard Hulse <richard.hulse@radionz.co.nz> | 2011-09-01 21:20:26 +1200 |
commit | cfd785f910fc914c576133fee263875833ba0c92 (patch) | |
tree | f2661edb9a4c5365dcef23b695178914057eb8a2 /railties/guides/source | |
parent | 1f998c7578d343310a4309bc0b06af224132648d (diff) | |
download | rails-cfd785f910fc914c576133fee263875833ba0c92.tar.gz rails-cfd785f910fc914c576133fee263875833ba0c92.tar.bz2 rails-cfd785f910fc914c576133fee263875833ba0c92.zip |
Move css data URI into css/erb section
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/asset_pipeline.textile | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index 3ed75a28ef..cfed1b5bdf 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -140,14 +140,6 @@ Images can also be organized into subdirectories if required, and they can be ac <%= image_tag "icons/rails.png" %> </erb> -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. - -<plain> -#logo { background: url(<%= asset_data_uri 'logo.png' %>) } -</plain> - -This inserts a correctly-formatted data URI into the CSS source. - h5. CSS and ERB If you add an +erb+ extension to a CSS asset, making it something such as +application.css.erb+, then you can use the +asset_path+ helper in your CSS rules: @@ -158,6 +150,14 @@ If you add an +erb+ extension to a CSS asset, making it something such as +appli This writes the path to the particular asset being referenced. In this example, it would make sense to have an image in one of the asset load paths, such as +app/assets/images/image.png+, which would be referenced here. If this image is already available in +public/assets+ as a fingerprinted file, then that path is referenced. +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. + +<plain> +#logo { background: url(<%= asset_data_uri 'logo.png' %>) } +</plain> + +This inserts a correctly-formatted data URI into the CSS source. + Note that the closing tag cannot be of the style +-%>+. h5. CSS and SCSS |