We use SASS for more productive CSS and the Ruby gem Sass to automatically convert our development .scss files into valid .css files.
Recently, an important bug fix appeared in the project’s master branch on GitHub and we wanted to update our local environments to use that new version for the translation from SASS to CSS.
This post is about how to do just that.
What we need
Of course, we need the project source from GitHub. You can either download a zip file and unpack it to a local folder or clone the repo (git clone "https://github.com/nex3/sass.git" "c:/projects/sass").
Now we need a Ruby command line. There’s a shortcut that’s already installed called “Start Command Prompt with Ruby” but running it returns an error:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
You need to fix the command used in that shortcut: in the Windows start menu right-click on the above mentioned entry, choose Properties and add double quotes to the last argument so that the command reads:
C:\Windows\System32\cmd.exe /E:ON /K "C:\Program Files (x86)\Ruby192\bin\setrbvars.bat"
Now start the command as Administrator and it returns on the first line:
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Compile the source and install the new gem
From the command line we can now execute Ruby programs, e.g. gem. Navigate to the Sass source code directory, build the gem and then update the already installed version with the new one from the local gem file. Finally, install a new gem called fssm which seems to be needed by this new version but forgotten to be added to the sass.gemspec file:
cd c:\Projects\sass
gem build sass.gemspec
gem update sass -–prerelease
gem install fssm
This should output something like:
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from sass.gemspec:31
.
Successfully built RubyGem
Name: sass
Version: 3.2.0.alpha.0
File: sass-3.2.0.alpha.0.gem
and
Updating installed gems
Updating sass
Successfully installed sass-3.2.0.alpha.0
Gems updated: sass
Installing ri documentation for sass-3.2.0.alpha.0...
Installing RDoc documentation for sass-3.2.0.alpha.0...
Fetching: fssm-0.2.8.1.gem (100%)
Successfully installed fssm-0.2.8.1
1 gem installed
Installing ri documentation for fssm-0.2.8.1...
Installing RDoc documentation for fssm-0.2.8.1...
That’s it, you’re ready to use the newest version of Sass!
Happy coding!