Module Sprockets::Sass::Functions
In: lib/sprockets/sass/functions.rb

Methods

Public Instance methods

Using Sprockets::Context#asset_data_uri return a Base64-encoded `data:` URI with the contents of the asset at the specified path.

Examples

  background: asset-data-uri("image.jpg"); // background: url(data:image/jpeg;base64,...);

Using Sprockets::Helpers#asset_path, return the full path for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  background: url(asset-path("image.jpg"));                // background: url("/assets/image.jpg");
  background: url(asset-path("image.jpg", $digest: true)); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");

Using Sprockets::Helpers#asset_path, return the url CSS for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  background: asset-url("image.jpg");                // background: url("/assets/image.jpg");
  background: asset-url("image.jpg", $digest: true); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");

Using Sprockets::Helpers#font_path, return the full path for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  src: url(font-path("font.ttf"));                // src: url("/assets/font.ttf");
  src: url(font-path("font.ttf", $digest: true)); // src: url("/assets/font-27a8f1f96afd8d4c67a59eb9447f45bd.ttf");

Using Sprockets::Helpers#font_path, return the url CSS for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  src: font-url("font.ttf");                  // src: url("/assets/font.ttf");
  src: font-url("image.jpg", $digest: true);  // src: url("/assets/font-27a8f1f96afd8d4c67a59eb9447f45bd.ttf");

Using Sprockets::Helpers#image_path, return the full path for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  background: url(image-path("image.jpg"));                // background: url("/assets/image.jpg");
  background: url(image-path("image.jpg", $digest: true)); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");

Using Sprockets::Helpers#image_path, return the url CSS for the given source as a Sass String. This supports keyword arguments that mirror the options.

Examples

  background: image-url("image.jpg");                // background: url("/assets/image.jpg");
  background: image-url("image.jpg", $digest: true); // background: url("/assets/image-27a8f1f96afd8d4c67a59eb9447f45bd.jpg");

[Validate]