0

I unfortunately have to install two versions of Compass(1.0.3, 0.12.2) and two versions of Sass(3.4.21, 3.2.19) on my computer - I have a newer and an older project that require me to have these two versions installed. I was given the older project recently, so I've only just now installed these older versions.

I'm using "compass watch" to compile, and while they both compile fine, I think the newer Compass (1.0.3) is using the older Sass (3.2.19) for the newer project. Now when I try to compile my newer project, it creates a huge diff if I change a single line (#fff instead of "white", all of the line number comments were changed slightly, stuff like that).

Is there any way to tell which version Compass is using, and furthermore, can I set it to use a specific version without uninstalling Sass everytime?

cimmanon
  • 67,211
  • 17
  • 165
  • 171
Sean Beck
  • 181
  • 2
  • 13
  • 1
    Compass 1.x will only use Sass 3.3 or later, Compass 0.12 will only use Sass 3.2 and older. There is no way that Compass 1.x will compile with Sass 3.2. Note that this is one of many reasons why it is recommended that you don't put the compiled results in your repo. Unless you have a dependency that specifically requires an older version, the newest version of your gems will be used. – cimmanon Mar 09 '16 at 21:36
  • We're on Acquia, so no compiling of Sass on the server is possible. Thanks for the info. – Sean Beck Mar 09 '16 at 21:37
  • No one said anything about compiling on a production server. It's just not recommended to keep the compiled results in your repo (you don't keep a compiled executable in your repo, do you?) – cimmanon Mar 09 '16 at 21:38
  • With Acquia, you push your code to the production server with Git, I don't see a way around it. – Sean Beck Mar 09 '16 at 21:41
  • For controlling which version of Compass you want to run, this question will work for you: http://stackoverflow.com/questions/4373128/how-do-i-activate-a-different-version-of-a-particular-gem. I am not aware of any way to control which version of Sass it executes, though, outside of either creating a Compass Extension (which requires a gem file) or by unpacking/repacking the Compass gem after updating its gem file. – cimmanon Mar 09 '16 at 22:49
  • Well, I just upvoted your first comment, but now I'm not sure it's correct. After I reinstalled the latest version of Sass and used the compass command to run the old version, it stopped compiling correctly. So it looks like .0.12.2 will try (and fail) to use 3.4 Sass or later. – Sean Beck Mar 10 '16 at 15:52
  • Check the dependencies. [Compass 0.12.2 explicitly depends on Sass >=3.1 && <3.2](https://rubygems.org/gems/compass/versions/0.12.2). (see also: http://stackoverflow.com/questions/4292905/what-is-the-difference-between-and-when-specifying-rubygem-in-gemfile) – cimmanon Mar 10 '16 at 15:57

1 Answers1

0

Use Bundler.

Create a Gemfile for each of your projects.

$ gem install bundler
$ cd project && touch Gemfile

Add to Gemfile:

source 'https://rubygems.org'
gem 'compass', '0.12.2'

Replace with appropriate version.

Now when you start working on a specific project, cd to it and run:

$ bundle install
tribe
  • 321
  • 2
  • 9