I have just upgraded to Sass 3.3 so that I can use some of the new features (BEM styled class names, mappings, #at-root, etc). If I compile my project with Sass (via sass --watch), it works just fine. However, if I compile it using Compass (via compass watch), I get an error when using the new Sass features.
I'm using Compass 0.12.
Compass 0.12 explicitly depends on Sass 3.2. Even if you have a newer version of Sass installed, it will still compile with 3.2. In order to use Sass 3.3 or later, you have to be using Compass 1.0 or later.
Running the gem install command normally should get you the latest stable version.
gem install compass
At the time this question was asked, Compass 1.0 was still in beta. To install the latest beta version of a gem, you will need to install it using the --pre flag.
gem install compass --pre
Note that you do not need to install Sass first in order for this to work. Installing Compass will automatically install the latest version of Sass that it is compatible with.
I have Compass 1.0 installed and it still errors
Double check any other dependencies you might have (Compass extensions, etc.), one of them might be specifying an older version of Sass or Compass.
If you're using an application or build tool rather than using the commands directly, make sure they're not referencing older versions of Compass.
Windows users
As a Window user, I got an error when I tried to watch my project using the newer Compass.
LoadError on line ["36"] of C: cannot load such file -- wdm"
To fix that problem:
You must install the ruby DevKit:
Download found here: http://rubyinstaller.org/downloads/
Follow this page to properly install:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Now install wdm:
gem install wdm
There didn't seem to be any one place that contained the whole list of steps required, in order, to make this work, so here they are. This list is for Windows, but it may work fine on other platforms.
Install Ruby -- use 1.9.3 -- http://rubyinstaller.org/downloads .
Download the Ruby DevKit found lower on the same page -- http://rubyinstaller.org/downloads/
run it to extract it somewhere (permanent). Then cd to it, run “ruby dk.rb init” and “ruby dk.rb install” to bind it to ruby installations in your path.
gem install wdm
gem install sass
gem install compass --pre
It now is, in the latest version of Compass. Update compass to get the changes and work with Sass 3.3 and higher
Current Sass compatibility can be found here: https://rubygems.org/gems/compass
To upgrade just run
$gem install compass
Related
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?
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
I have a fresh OpenSuse 13.1 installation with all updates installed.
ruby -v --> ruby 2.0.0p247 (2013-06-27) [x86_64-linux]
gem -v --> 2.3.0
Running gem env outputs following: EXECUTABLE DIRECTORY: /usr/bin. It is also in my $PATH.
I tried to install sass and compass as described by the installation guides:
sudo gem install sass
sudo gem install compass
(I needed to use sudo because it didn't work without)
Only problem: neither running the commands sass nor compass work.
After a while I figured out that I had to use sass2.0 and compass2.0 to run them. The ruby scripts in /usr/bin are named with 2.0 at the end of the filename.
Why are those ruby scripts named with 2.0 at the end? How can I prevent this? I would like to use just compass and sass in the terminal.
I didn't get any results using Google.
It looks like openSUSE patches rubygems to keep multiple ruby versions installed, so it appends version number to files in bin/.
I've tried install sass package on my Linux x86_64 system and it produced sass, scss and sass-convert executables without extension.
I'd also warn to install gems this way, directly into filesystem. I'd recommend not avoiding package management and install through properly built packages. At openSUSE's wiki there is paragraph about how to package Ruby gems into rpms .
There is a solution to this problem in this SeverFault Post: https://serverfault.com/questions/535450/install-gems-of-ruby-1-9-bins-without-suffix-in-opensuse
You have to add the parameter --no-format-executable the the gem install command. Since I did not want to clutter my system I installed sass like this:
gem install --install-dir ./gems --no-format-executable sass
Now I can execute it with ./gems/bin/sass
I downloaded two gem files: Sass-3.3.7.gem & compass-0.12.6.gem
I ran gem install --local Sass-3.3.7.gem which it installed.
Followed by the same command for compass, but got the error:
unable to resolve dependencies: compass requires sass (~>3.2.19)
I'm installing them pre-downloaded as I have no connection. Anyone knows what can be the solution?
Compass 0.12.6 apparently depends on sass ~>3.2.19, which means that the version of sass should be bigger than 3.2 and smaller than 3.3, so basically compass needs sass 3.2.x. You have two options.
Also download sass 3.2.19, install both versions of sass, use the latest one yourself and make compass happy.
Just install sass 3.2.19 and use that yourself as well, this obviously only works if you don't need any features introduced in sass 3.3.
Install Sass 3.2.19:
sudo gem install sass -v 3.2.19
I didn't need Sass 3.3.7, and Jekyll keep finding the latest version installed, so I got uninstalled Sass 3.3.7:
sudo gem uninstall sass
Sass doesn't seem to overwrite previous versions, so I still had 3.3.2 installed (if there are multiple versions installed it gives you a choice of what version you'd like to uninstall), so I uninstalled that as well.
You can run gem dependency <gem name> to see list of the gem dependencies and required versions.
CodeKit is giving me the error of
Compass was unable to compile one or more files in the project:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: illegal switch in RUBYOPT: -E (RuntimeError)
(This action was triggered by a change to _settings.scss)
It was working fine before the Upgrade.
Found the solution. Go to the "Terminal" and type:
sudo gem update --system
sudo gem install compass
And it's done!
You have CodeKit set to use an external Compass compiler, but you're running that Compass compiler in the old version of Ruby from 10.8 (Ruby 1.8.7).
You need to make sure Compass is running on the new system-installed version of Ruby (2.0) in Mavericks. Once you do that, you'll be all set. If you're using RVM, you can switch it back to the system Ruby and then simply run sudo gem install Compass to have Compass installed in the standard location.
I had this same problem just now. I installed compass again as Bryan suggested. After this it still didn't work, so I went into my preferences and saw that I previously had Codekit compiling from Compass at a user selected path. I switched this to "USe Codekit's internal Compass copmiler" and it is working again.
Found the solution. Go to the "Terminal" and type:
sudo gem update --system
sudo gem install compass
If you see this error:
Gem::LoadError on line ["298"] of /Library/Ruby/Site/2.0.0/rubygems/dependency.rb: Could not find 'zurb-foundation' ....
You probably need to install zurb-foundation, type this:
sudo gem install zurb-foundation
I just Changed my Compass Advanced settings back to internal compass compiler (recommended) and it worked.
I have two versions of Compass, 0.12 and 0.13.alpha. The default version is 0.13.alpha but sometimes I need to switch to 0.12.
What command will permit this, please?
old topic, but I just came across the issue of having 2 projects. one using compass version 0.12 and the other 1.0.
as the newer version of compass relies on a new major release of sass, many deprecation warnings and compatibility issues are experienced when trying to run the newer compass on the old project.
well, now to the solution:
ruby gems already support having multiple versions installed. and after taking a look into the compass executable, it turns out there is a way to specify which compass version to use (the file is generated by rubygems, see http://pastebin.com/HeZnE0T5 if you are curious)
with that we can now have multiple versions of compass installed at once. eg:
gem install compass -pre // currently version 1.0.0.alpha.19
gem install compass // currently version 0.12.6
and now we can use them by specifying which version to use:
$ compass version
Compass 1.0.0.alpha.19
Copyright (c) 2008-2014 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
$ compass _0.12.6_ version
Compass 0.12.6 (Alnilam)
Copyright (c) 2008-2014 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
this obviously also works for other compass commands, eg watch:
$ compass _0.12.6_ watch .
>>> Compass is watching for changes. Press Ctrl-C to Stop.
EDIT: of course the version switch can be done in a Gemfile, but in my case its not a ruby project and compass is started via command line
If you are switching versions for different projects, I recommend using either RVM (Ruby) or virtualenv with some help (Python) or something similar to manage gems and versions. Bundler will help make either solution simpler to maintain.
If you are switching versions within a project, I recommend reconsidering your approach.
This is really simple using bundler.
Install bundler:
$ gem install bundler
Create the Gemfile in your project if you don't already have one:
$ bundle init
Specify the version you want/need in your Gemfile:
gem 'compass', '~>0.12.2'
gem 'sass', '3.2.8'
Install the specific gems and dependencies you have defined in your Gemfile:
$ bundle install
When executing a gem, you can now use bundler to control which version to execute based on your Gemfile:
$ bundle exec compass watch
That's it!
It's helpful to leave a comment in your Gemfile telling other developers how to use bundler:
# Now that you're using Bundler, you need to run `bundle exec compass watch` instead of simply `compass watch`.
Read more about versioning at http://bundler.io/v1.6/gemfile.html
Change the gemfile, add in a version parameter.