How to add Compass syntax support to Jetbrains PhpStorm?

你离开我真会死。 提交于 2019-11-28 18:49:24

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

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!

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.

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.

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