Reputation: 377
Why i can't get an image to work. I'm trying this:
background-image: url(jBootstrap/images/ui-icons_222222_256x240.png);
and it doesn't work. When i'm trying to access it trought URL i get an error:
Asset [stylesheets/jBootstrap/images/ui-icons_222222_256x240.png] was unable to be processed.
Can't get any images, tried in many variations of directories and still doesn't work. When i'm doing this on plain html-css it works perfectly, but not in laravel. What am I doing wrong ?
btw, i'm using Basset if it helps.
Also including the additional information about a partial structure of my public folder and html link generated by basset:
it contains the background-image...
when including the css file, in source code i see:
<link rel="stylesheet" type="text/css" href="http://localhost/Job/worker/myapp/public/7n3C5wypAmTi8VT8/application/stylesheets/main.css" />
Adding my public/.htaccess file:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Tried another way:
public/stylesheets/main.css
public/stylesheets/abc.jpg
in main.css
I have code: body { background-image: url('abc.jpg') }
and i'm getting nothing ...
Please help, struggling 2 days now ...
Upvotes: 0
Views: 1751
Reputation: 2063
Try using setArguments('../')
on your collection
'collections' => array(
'application' => function($collection) {
$collection->add('../vendor/twitter/bootstrap/less/bootstrap.less')->apply('Less');
$directory = $collection->directory('assets/stylesheets', function($collection) {
$collection->add('main.css');
})->apply('UriRewriteFilter')->setArguments('../')->apply('CssMin');
}
),
This did the trick for me.
Upvotes: 0
Reputation: 377
Found the problem... It was Basset package, it wat required to put $collection->apply('UriRewriteFilter');
into configurations.
Upvotes: 1
Reputation: 9007
I would naturally assume that one (or both) things are incorrect here:
Your .htaccess
file is not checking for existing files when rewriting. Check to see if RewriteCond {%REQUEST_FILENAME} !-f
exists in that file.
You are not requesting your background image from the root, i.e. absolutely. Try requesting the resource using a leading slash. For example, instead of calling foo.png
, try calling /foo.png
.
Upvotes: 0