Import LESS to LESS from multiple subdirectories

This script was testet in Visual Studio 2012 with the Web Essentials extension.

Filesystem:

root \ folder1 \ subfolder1 \ styles \ main.less

root \ folder2 \ subfolder1 \ subfolder2 \ Styles \ fear.less

main.less:

@import "../../../folder2/subfolder1/subfolder2/styles/fear.less"; 

Compilation Error:

LESS: Failed to load folder2 / subfolder1 / subfolder2 / styles / fear.less (404)

Is it possible that LESS does not support multiple subdirectories?

+4
source share
2 answers

Ok now I get it! @Jeff's answer led me to the following:

 @import "..\..\..\folder2\subfolder1\subfolder2\styles\fear.less"; 

It also works for variables. You must declare the entire file name, including the extension. No slash and just a backslash.

0
source

This is apparently a known bug / problem. In the meantime, you can replace the slash in the import path with a backslash. It worked for me.

+3
source

Source: https://habr.com/ru/post/1482912/


All Articles