Skip to content

@import with relative paths not resolving correctly #1083

@pclifton

Description

@pclifton

Given the following directory structure:

./app.less:
@import "subdir/lib.less";

./mixins.less:
/* These are mixins from the root dir */

./subdir/lib.less:
@import "mixins.less";

./subdir/mixins.less:
/* These are mixins from subdir */

If app.less is compiled from the root directory, lib.less includes the mixins from the root dir instead of the subdir:

lessc app.less
/* These are mixins from the root dir */

I discovered this while working with Bootstrap and also importing my own custom mixin file; when I tried to compile from my root less directory, Bootstrap was importing my mixins instead of boostrap/mixins since I gave mine the same name. Simply renaming my mixin file to something unique allows to me compile without problems, but this still seems like a problem with how lessc handles relative path imports.

It should be noted that these paths are handled correctly when rendering client-side with less.js, which is how I started developing. I only ran into this problem while trying to work out a build process using recess.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions