简体   繁体   English

如何使Eclipse内容在任何地方都可以使用通用CSS?

[英]How to make the Eclipse content assist for common CSS available everywhere?

In my Eclipse project I have a template.html which is the base template for all the other html files. 在我的Eclipse项目中,我有一个template.html,这是所有其他html文件的基本模板。 In that template.html, I can access all of the CSS classes via content assist, because I included all of the CSS stuff in there. 在该template.html中,我可以通过内容辅助访问所有CSS类,因为我在其中包括了所有CSS内容。

Naturally, I don't do very much in the template.html, so that doesn't help at all. 自然,我在template.html中没有做太多事情,因此根本没有帮助。 But the content assist doesn't work in any other file, unless I include all of the css files again - which seems like the wrong approach to me. 但是内容辅助功能无法在任何其他文件中使用,除非我再次包含所有css文件-这对我来说似乎是错误的方法。

Is there any way to let Eclipse know or assume that I can use that CSS anywhere without problems, because I included it at some point higher in the template-tree? 是否有任何方法可以让Eclipse知道或假定我可以在任何地方使用该CSS而不会出现问题,因为我将它包含在模板树中更高的位置吗?

I googled for quite some time now but I can't seem to find the right words to search for. 我现在在Google上搜索了很长时间,但似乎找不到合适的词来搜索。 Any suggestions? 有什么建议么?

Solved it. 解决了。

I somehow missed the "CSS" entry in Window -> Preferences. 我以某种方式错过了Window-> Preferences中的“ CSS”条目。 There you can activate "Search CSS id and class in all CSS files (if no link)?". 您可以在那里激活“在所有CSS文件中搜索CSS ID和类(如果没有链接)?”。 Make sure that under "Configure Project Specific Settings..." in that same view the project specific settings for the relevant project are disabled. 确保在同一视图的“配置项目特定设置...”下,禁用相关项目的项目特定设置。 Then content assist will provide you with suggestions while typing. 然后,内容帮助会在键入时为您提供建议。

Also, you need to disable warnings for unknown CSS classes, because these warnings and the content assist don't seem to work together very well. 另外,您需要禁用针对未知CSS类的警告,因为这些警告和内容辅助功能似乎无法很好地协同工作。 To do that, got to Window -> Preferences -> Web -> HTML Files -> Web Resources and open the CSS submenu in the view. 为此,请转到窗口->首选项-> Web-> HTML文件-> Web资源,然后在视图中打开CSS子菜单。 There you need to set both "Unkown CSS class" and "Unknown CSS ID" to "Ignore". 在那里,您需要将“未知CSS类”和“未知CSS ID”都设置为“忽略”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM