0

I just started to work with CSS and espacialy Sass. What I tryed to do for the last hour was to set a background image from my source folder from my scss. file.

enter image description here

I tryed several ways of accesing my directory. But not a single one worked. My IDE (IntelliJ IDEA) always tells me that it can not resolve the directory. I tried:

background-image:url('${resource(dir: "images", file: "bg.png")}');
background-image:url(../images/bg.png);
background-image:url('../images/bg.png');
background-image:url(../images:bg.png);
background-image:url('../images:bg.png');

And also as refered in this topic How to refernce JSF image:

background-image: url("#{resource['images/bg.png']}");

I hope one of you can provide me with a solution.

EDIT

this line gives no error in the .scss file:

background-image:url("/resources/images/bg.png");

but it precompiles wrong in the .css file because the directory can not be resolved anymore.

EDIT

the code that does not get marked as problem in either .scss or .css is:

 background-image:url("../../../src/resources/images/bg.png");

But it still does not work my background remains white.

Community
  • 1
  • 1
Tom Wellbrock
  • 2,982
  • 1
  • 13
  • 21

1 Answers1

0

I've found the solution.

The problem was, that I tryed to access my java resources folder. But I had to access a child of the webapp folder. As the .WAR is build from that context. That means this was the solution.

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

while my images folder is a child of my webapp folder.

Tom Wellbrock
  • 2,982
  • 1
  • 13
  • 21