Nette {$basePath} in PhpStorm

Raerik
Member | 2
+
0
-

Hey guys,
I was just wondering whether it is possible to somehow tell PhpStorm what {$basePath} macro is, or just give him the local path to substitute macro for. It causes me trouble, because everytime i wanna move or delete js, css,… files it cannot check the project for usages and replace paths or just warn me before deleting.

Thanks for your time,
Patrik Marek

GEpic
Member | 566
+
+13
-

Mark WWW directory as Resource root (purple color) in PHPStorm, {$basePath} isn't macro, $basePath is just a PHP variable, nothing more. With this easy setting will $basePath always point to WWW directory, which will be set as resource root and links to your .css / .js files will work as expected.

Simply:

Will then appear likes this:

So then links like:

<script src="{$basePath}/assets/js/main.js"></script>

Will work as expected. Also you can click on line with link and press ctrl+b and jump directly into that file

Last edited by GEpic (2018-05-08 11:41)

Raerik
Member | 2
+
+1
-

GEpic wrote:

Mark WWW directory as Resource root (purple color) in PHPStorm, {$basePath} isn't macro, $basePath is just a PHP variable, nothing more. With this easy setting will $basePath always point to WWW directory, which will be set as resource root and links to your .css / .js files will work as expected.

Simply:

Will then appear likes this:

So then links like:

<script src="{$basePath}/assets/js/main.js"></script>

Will work as expected. Also you can click on line with link and press ctrl+b and jump directly into that file

Wow, thank you very much, you are my savior :D