Switching Between Compass Versions

PV Pablo Vallejo Pablo Vallejo

Pablo Vallejo

Software Engineer
1 min read.


Compass is a great framework that helps us writing clean styles using Sass, creating sprites, using mixins and among other features it makes it easy to author Websites.

One of the problems we had when using it, was that as we have several Django projects we're very used to have different version of dependencies for each project using VirtualEnvWrapper, therefore,
we wanted to as well have multiple versions of compass and switch them in a per project basis.


So, after reading a little and browsing for answers on StackOverflow we found that having multiple compass versions was pretty easy as we could install the versions we needed and pass the desired one as a parameter to the compass command.


That sounds nice, show me the code! so here's how we go about it.

Install all the compass versions you want to use

# Install the latest version
gem install compass

# Install 0.10.5
gem install compass -v 0.10.5

# Install 0.12.6
gem install compass -v 0.12.6

Once in a project, if we want to compile the styles using compass 0.10.5 we would type:

compass _0.10.5_ compile app/static

And the same goes for another project that uses the version 0.12.6 of compass

compass _0.12.6_ compile app/static

This option also works for the watch command.

compass _0.12.6_ watch app/static


And after doing this, we were able to use a different version of compass depending on the project we were working on.

References


Happy Styling!


Written by Pablo Vallejo

PV Pablo Vallejo Pablo Vallejo

Pablo develops and optimizes software solutions, focusing on functionality and user experience. His expertise in coding and problem-solving ensures the creation of efficient and reliable applications.

Newsletter

Subscribe to our newsletter:

Read more

OSX infinite login issue

OSX is a Linux cousin, if you know about the command line, you can fix problems, your system shouldn't be a black box. &nbsp...

1 min read.

Build Once. Own Forever.