Less files location for path resolution

Currently if I include less files in other files with say string:

@import '/lib/bootstrap3/less/mixins';

It will resolve (find and check) path only if /lib is located in root folder, otherwise it will underline the path with red.

I'm able to compile such files with standard less plugin and filewatcher by adding option --include-path to less executable.

So the question is it possible to force IDE to resolve paths in *.less includes relative not root projet folder but other?

0
4 comments

Hi there,

Is it still located within the project or outside?

  • If within: try marking parent folder as Resource Root
  • if outside: you have to include it into your project somehow -- for example as Additional Content Root via "Settings | Directories"


In any case: http://youtrack.jetbrains.com/issue/WEB-7452

0
Avatar
Alex Oshchepkov

Thanks, marking as Resouce Root works.

0
Avatar
Alex Oshchepkov

I have the following structure:

/projectRoot
  /front-app
    /app
      /application.less
    /styles
      /common.less


I marked front-app as Resource Root

application.less has
@import '/styles/common.less'

after it was marke the path is not underlined with red but to be compiled it is still requires --include-path for lessc.cmd:

Arguments: --no-color  --include-path="$ProjectFileDir$/front-app" $FileName$

Without --include-path it errors.

Is it exptected? Can I get rid of need of the --include-path?

0
Is it exptected?

Yes.

It's lessc itself who does compilation and not PhpStorm. You can see exact command if you choose to show console to "Always".

Can I get rid of need of the --include-path?

No.

lessc (LESS compiler) needs to know where to search for such included files.

I gave you the link to the related ticket already. Will give it again: http://youtrack.jetbrains.com/issue/WEB-7452


You could try this, if you want:
@include '../styles/common.less'
or
try to re-organize your your folder structure and make it simpler (if it's possible, of course).

0

Please sign in to leave a comment.