Panos Karampis Panos Karampis - 1 year ago 223
Less Question

lesscss @import with absolute path

I am having issue trying to refer from a less file another less file using absolute syntax:

Less file A with location

$find `pwd` -name auth0.less

imports Less file B

@import '/bootstrap/less/so_colors.less';

Now, the so_colors.less has location

find `pwd` -name so_colors.less

The above fails with File /Users/panos/dcimsupport/struxureon/auth0/src/main/resources/css/bootstrap/less/so_colors.less

It seems that lesscss is like jailed to the css folder. I know that if I import as ../bootstrap/.....less it will work but then I have to go as up in directories as required which i'd rather not. Is there some other solution to that? There is limitation though, that bootstrap folder cannot be under css folder

I have used both




with configuration such as


Answer Source

How plugins works

The biz.gabrys.maven.plugins plugin treats the path /bootstrap/less/so_colors.less as an absolute. It does not set the sourceDirectory as a root, so it is looking for /bootstrap/less/so_colors.less instead of /Users/panos/dcimsupport/struxureon/auth0/src/main/resources/bootstrap/less/so_colors.less. That file does not exist so the plugin uses fallback and treats it as a relative to /Users/panos/dcimsupport/struxureon/auth0/src/main/resources/css/auth0.less. That is the reason why it is looking for /Users/panos/dcimsupport/struxureon/auth0/src/main/resources/css/bootstrap/less/so_colors.less.

The org.lesscss plugin works similar.

Your idea for improvement

I can try to add such improvement to my plugin, but first I need finish some migration process. Unfortunately this means that I can release that improvement not in the near future (e.g. at the end of 2016).

The org.lesscss plugin is not supported by the author and no one else.


For now you can only use relative paths with ../.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download