0

I have to add .xhtml in an url in css in order to have my image considered, else it's not found(no typo).

ex, this is found:

background-image: url(flags/flags-32.png.xhtml);

this is not found:

background-image: url(flags/flags-32.png);

my file is under resources/css/flags.

I've also a side question that is indirectly tied to this :

  • I've read somewhere that one shouldn't have extensions like .png.xhtml or .script.xhtml as it could impact negatively performances. I can't find the source of where I read that but I'd like to know why that is the case (maybe it's because of cache).
Ced
  • 15,847
  • 14
  • 87
  • 146

3 Answers3

0

Try to add resource before your flag folder

url("#{resource['flags/flags-32.png']}");

Dom
  • 9
  • 2
  • This is how I found out I had to add .xhtml, so I know about that. Thing is I'd like not to have the .xhtml at all(because of my side question) – Ced Mar 28 '16 at 03:32
0

when .xhtml is appended to the end of a file the url is :

javax.faces.resource/...

while if you want to access a .js file directly for example the url is :

resources/script/myscript.js

don't forget the s in resources.

Ced
  • 15,847
  • 14
  • 87
  • 146
-1

You should try like this

background-image: url(../images/imageName.gif); 

if your folder structure like this resources->images->imageName.gif.

Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202