Last Updated: February 25, 2016
·
3.075K
· bez4pieci

How to run compass from Intellij IDEA

Intellij IDEA offers its own watchers for sass and scss files, but compass is not directly integrated. You can create a Run configuration to run Compass in background inside the IDE. Just follow the steps below.


  • Create a new Ruby run configuration and name it "Compass"

  • Point Ruby script field to the compass executable file. If you're using Link, then it will look like this: ~/.rvm/gems/ruby-1.9.3-p392/bin/compass.

  • Put watch in Script arguments field

  • Set working directory to the directory where you would normally run compass watch from Terminal

  • Then you need to specify the Ruby SDK to use. IDEA detects ruby modules (basically, directories with a Gemfile in it, and offers you to add them as modules for your project. The SDK thus gets added automatically. If you haven't done it, you can add the SDK manually. In your project settings go to Platform Settings / SDKs and add a new Ruby SDK.

Note: If you use RVM, don't choose the auto-detected /usr/bin/ruby, but go for "New Local..." and choose the ruby executable from your RVM. It will be either something like /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby or ~/rvm/rubies/ruby-1.9.3-p392/bin/ruby, depending on whether you installed RVM for all users or for the current user only.


That's it! Choose "Compass" from your run configurations drop-down, and press Play.

2 Responses
Add your response

I'm using Intellij's File Watcher plugin, which runs /usr/local/bin/compass with argument compile and in working dir $FileParentDir$. I used compass watch in terminal but File Watcher and compass compile is much faster (in my env).

over 1 year ago ·

I can run Compass in Intellij. It just doesn't seem to find any changes.

over 1 year ago ·