Compass URL Helpers
These url helpers isolate your stylesheets from environmental differences. They allow you to write the same stylesheets and use them locally without a web server, and then change them to be using asset hosts in production.
They might also insulate you against some code reorganization changes.
stylesheet-url($path, $only-path)
Generates a path to an asset found relative to the project's css directory.
Passing a true value as the second argument will cause pronly the path to be returned
instead of a url()
function
font-url($path, $only-path, $cache-buster)
Generates a path to an asset found relative to the project's font directory.
Passing a true value as the second argument will cause only the path to be returned
instead of a url()
function
The third argument is used to control the cache buster on a per-use basis.
When set to false
no cache buster will be used. When a string, that
value will be used as the cache buster.
image-url($path, $only-path, $cache-buster)
Generates a path to an asset found relative to the project's images directory.
Passing a true value as the second argument will cause only the path to be returned
instead of a url()
function
The third argument is used to control the cache buster on a per-use basis.
When set to false
no cache buster will be used. When a string, that
value will be used as the cache buster.
generated-image-url($path, $cache-buster: false)
Generates a path to an image generated during compilation using the
generated_image
related configuration properties.
Most users will never call this helper directly, it is primarily provided
for use by plugins that need to generate paths to images they create. E.g.
The sprite-url()
helper calls this helper.
The second argument is used to control the cache buster on a per-use basis.
Defaults to false
, meaning that no cache buster will be used.
When a string, that value will be used as the cache buster, when true
Compass will generate a cache-buster based on the image's modification time.