1

I'm using less loader with webpack and in one of my style files, I tried to set up a background image for some element with following code:

.slider_params(@width: 100%; @height: auto; @min-height: 50%;) {

    width: @width;
    height: @height;
    min-height: @min-height;
    background-image:  url("../images/wrk_samples__book.jpg");
}

work_samples__item_container {

  .slider_params();

}

But it doesn't work at all. The console doesn't throw any errors, but in my browser I still can't see any background images for the element. I have url loader and file loader for webpack, the file from the directory is thrown each time to my build folder. Messing around with paths and trying to load the image from ./build doesn't help, the console outputs an error "cannot find module"

What is the reason?

1 Answer 1

2

Well, I figured what the issue was. I needed to add ~!file! to the url of bg property, after that everythings worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.