Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move css data URI into css/erb section

  • Loading branch information...
commit cfd785f910fc914c576133fee263875833ba0c92 1 parent 1f998c7
@rhulse rhulse authored
Showing with 8 additions and 8 deletions.
  1. +8 −8 railties/guides/source/asset_pipeline.textile
View
16 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
Please sign in to comment.
Something went wrong with that request. Please try again.