CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

Which path to use for an image inside a css/less file? #86

Closed vincentcordel closed 10 years ago

vincentcordel commented 10 years ago

When I have my css files in the assets directory outside of the public directory, I tried to get back to the public path (../../public) for an image I want to use in a background css declaration.

However, it's not working. The path still starts with assets.

Which path do I need to use so I can keep my files outside of the public directory?

Thanks!

kdocki commented 10 years ago

@musixite I assume you are using latest version of asset pipeline?

You can put your images in the /app/assets/stylesheets/ directory or you can put the images in /app/assets/images/.

If you have /app/assets/images/foobar.png then you can find that image at http://[hostname]/assets/foobar.png.

If you have /app/assets/stylesheets/foobar.png and /app/assets/stylesheets/foobar.css` and inside of that css file do

 .mystyle {
   background: url(foobar.png);
 }
vincentcordel commented 10 years ago

Perfect, thanks!

My mistake was to put the images dir on the root of the assets. It seems like it's impossible to go down a level.

But it's all good now ;)