A
A
Anna2017-05-01 16:01:40
css
Anna, 2017-05-01 16:01:40

Problem compiling sass?

During layout, in files with the .scss extension, some blocks were given the background-image property with the following path: ../../img/img-name.jpg .
When compiling, it turns out that chrome cannot find this image, referring to the wrong path.
The project structure is as follows:

css/
    | - style.css
sass/
    | - style.scss
    | - blocks/
         | - block_name.scss (задаю фон здесь)
img/
    | - backgrnd_img.jpg
index.html

Obviously, the above path breaks when it is transferred to style.css, or rather, it is transferred without changes, and this is the error. Please advise how this could be corrected.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2017-05-01
@anndarina

Unfortunately Sass doesn't know how to resolve such paths. There is a problem, they know about it, but they don’t solve it yet (sass developers, I mean).
I made it a rule to write absolute links
/img/img-name.jpg
Yes, there are disadvantages, but somehow we live for now.

G
GoodProject, 2017-05-01
@GoodProject

../img/img-name.jpg.
and it is better to have only 2 folders css and sass then there will definitely be no problems)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question