Hi there. I can't seem to get the @import statement to include a .less file unless it's in the same directory as the file that contains the @import. Relative paths and absolute paths both fail. I don't get any errors in Drupal's log or find that it breaks the rest of the .less file, but it just doesn't seem to find the @import files.

Works:
@import 'base.css.less';

Doesn't work:
@import 'base/base.css.less';
@import '/sites/all/themes/<theme>/stylesheets/base/base.css.less';

Please let me know if there's any other info you need from me. Some of my projects have quite a bit of CSS spread out over a good number of LESS files, and it would be great to be able to organize them into sub-directories.

Comments

jox’s picture

coredumperror’s picture

I believe this may be a limitation of Less itself. I ran into this same problem in a non-drupal situation, and the Less app for OSX also outputs no errors when attempting to @import a non-sibling less file, yet fails to add the variables from said file.

corey.aufang’s picture

Status: Active » Closed (duplicate)

No, in this instance this is a limitation of Drupal.

The lessphp library might also have this same limitation, but in the LESS module .less files and their @import's are aggregated before being passed to lessphp.

I'm also closing this issue as its newer than #1331144: Multiple @import does not use expected pathing which discusses the same issue.