How to add Compass syntax support to Jetbrains PhpStorm?

人盡茶涼 提交于 2019-12-29 03:29:04

问题


I'm using JetBrains PhpStorm, which is probably the most epic IDE I've ever used.

The question is simple. How do I add Compass syntax support to it? I've got it installed, it renders and works, but PhpStorm still complains about undefined imports and mixins.

How can I resolve this? Can Compass be included as an external library?


Edit: I'd just like to note that this feature request is for the RubyMine IDE (also by JetBrains), it's not for PhpStorm/WebStorm.


回答1:


It's explanation of Martin's answer. Symlink to compass gem directory in your sass folder works great.

Instruction(Windows)

  1. open cmd with admin privileges
  2. change path to your project sass folder, for example cd projectname\sass
  3. run mklink /d compass $GEM_LOCATION\frameworks\compass\stylesheets\compass, as for me $GEM_LOCATION = C:\dev\Ruby200\lib\ruby\gems\2.0.0\gems\compass-0.12.2

Thats all, now PhpStorm will not highlight compass mixins as errors, and will add them in autocomplete suggestions.

Warning: If you want to delete created symlink DON'T use delete, it will remove source directory. open cmd with admin privileges, cd $yourProjectSassPath, and run rmdir compass




回答2:


As the above user mentioned it also works to add the path to the Compass stylesheets as a resource directory in your project.

For example, my compass stylesheets are located at: C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.2/frameworks/compass/stylesheets

  1. Go to Settings > Project settings > Directories.
  2. Add a content root
  3. Add the compass stylesheets directory
  4. Click 'Resource Root' (the blue icon)

When you apply you will see that PhpStorm finds the compass stylesheets without any problems. You can even ctrl+click (windows) on them to open them directly.

Good luck!




回答3:


I solved it by placing a symlink of the compass-directory (from $GEM_LOCATION/frameworks/compass/stylesheets/compass) into the folder where my stylesheet lives. It's more of a workaround but it makes me and the phpstorm-inspections/-autocompletion happy.




回答4:


I think it's better to add the directory in the Directories settings: http://www.jetbrains.com/phpstorm/webhelp/directories.html

In the example above, add a new content root of C:\dev\Ruby200\lib\ruby\gems\2.0.0\gems\compass-0.12.2.




回答5:


This is more easily fixed by using a better source for the executable.

From: http://youtrack.jetbrains.com/issue/WEB-9139

In Windows, use an executable path like:

C:\Ruby200\lib\ruby\gems\2.0.0\gems\compass-0.12.2\bin\compass

While on the Mac use something like:

/Library/Ruby/Gems/2.0.0/gems/compass-0.12.2/bin/compass


来源:https://stackoverflow.com/questions/13213631/how-to-add-compass-syntax-support-to-jetbrains-phpstorm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!