This will install SassC Ruby gem on Windows.
- Download and install Ruby 2 (http://rubyinstaller.org/downloads/)
- Download and install the ruby development kit (http://rubyinstaller.org/downloads/)
(for the rest of the document, assuming it's installed into
c:\devkit\
) - Download the libdl library for Windows (https://github.com/dlfcn-win32/dlfcn-win32)
Go to
releases
and download the most recent precompiled version. - Extract the libdl package into your development kit mingw directory:
e.g. extract the package (
lib\
andinclude\
) intoc:\devkit\mingw\
- Try installing
gem install sassc
(might fail) - If it installs successfully then try the sassc compilation test (at the bottom of this file)
- If failed to install properly then edit the libsass Makefile:
c:\ruby2\lib\ruby\gems\2.2.0\gems\sassc-1.8.1\ext\libsass\Makefile
Edit the makefile and force it to build a static library (especially under MinGW). Set the following variables to 1:
STATIC_ALL ?= 1
STATIC_LIBGCC ?= 1
STATIC_LIBSTDCPP ?= 1
- Start the dev kit command prompt:
c:\devkit\msys.bat
- Navigate to the sassc gem directory:
c:\ruby2\lib\ruby\gems\2.2.0\gems\sassc-1.8.1\ext\libsass
- Run
make lib/libsass.so LDFLAGS="-Wall -O2"
to compile the library. - DONE. Try the sassc compilation test.
Copy and paste into sassc.rb
:
require 'sassc'
# Simple scss content
data = <<-eos
$temp: red;
body {
color: $temp;
}
eos
# Compile and print the result
result = SassC::Engine.new(data).render
puts "result=#{result}"
Then from a command prompt run:
$ ruby sassc.rb
Expected output:
result=body {
color: red; }
Libsass build documentation:
Problem: ld cannot find -ldl
compiler error message
Fix: steps 3 and 4, install libdl into mingw dev environment
http://stackoverflow.com/questions/12455160/using-libdl-so-in-mingw
Problem: ruby_ffi "The specified module could not be found" error
Fix: step 7, build static library with libgcc
http://ffi.github.io/ruby-ffi-archive/messages/20110430-Re_%5Bruby-ffi%5D%20need%20help%20loading%20a%20library-805.html