Webstorm:"不能解析目录" [英] Webstorm: "Cannot Resolve Directory"

查看:1578
本文介绍了Webstorm:"不能解析目录"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是开始来烦我,我会要么喜欢它关闭或固定的。所以Webstorm有它的HTML解析器一个甜蜜的功能,将尝试解决在字符串中的目录,都应该引用文件在您的项目。例如:

This is starting to bug me and I'd either like it turned off or fixed. So Webstorm has a sweet feature in it's HTML parser that will attempt to resolve directories in strings that are supposed to reference a file in your project. For example:

Webstorm是正确的。我的前端code是所有 /应用程序但是我的服务器应用程序的根提供的文件,所以在Web上下文 /应用其实只是 / 。作为一个方面,这种行为也会影响我的角度模板:

Webstorm is correct. My front end code is all in /app but my server serves up files in app on the root, so in the web context /app is actually just /. As a side, this behavior also impacts my angular templates:

和我的角UI路线(我想这将做定期角路线以及)。

and my angular-ui routes (I imagine it would do that for regular angular routes as well).

有没有办法,我可以改变webstorm治疗 /应用程序作为根,所以这是一个非常有用的功能的方法吗?如果没有,有没有办法我可以禁用这个?我试图进入检查员,但无法找到它的一个选项:

Is there a way that I can change webstorm to treat /app as the root so this is a useful feature? If not, is there a way I can disable this? I tried going into the inspector, but couldn't find an option for it:

和不,这不是XML ......我试过了。

And no, it's not the XML one... I tried.

帮助AP preciated。谢谢...

Help appreciated. Thanks...

推荐答案

为使文件引用到项目中的非根文件夹,你需要标记该目录作为的资源即可。要做到这一点,进入设置>目录,并从右侧面板中选择您的资产根文件夹。通过点击文件浏览器上方的按钮,然后将其标记为资源的根。

To make file references to a non-root folder in your project, you'll need to mark that directory as a Resource. To do this, go to Settings > Directories and select your asset root folder from the right-hand panel. Then mark it as Resource Root by clicking the button above the file browser.

从JetBrains的文档,资源根的使WebStorm完成相对路径的资源选择的文件夹下的的。这意味着你应该使用资源的根包含所有的资源文件夹,你想引用(例如样式,脚本,...)。

From the Jetbrains documentation, a Resource Root enables WebStorm to complete relative paths to resources under the selected folder. This means that you should use Resource Root on a folder that holds all the resources you would like to refer to (e.g. styles, scripts, ...).

这篇关于Webstorm:"不能解析目录"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆