104

Is there a way to use Sass or Compass or anything like that without Ruby?

I have been looking around google and this site and can't find anything, any help would be appreciated. Thank you

4
  • Node.js port (and Node.js - express - jade - compile SASS/LESS). Commented Sep 29, 2012 at 22:19
  • 3
    Is this a real question? I mean it's unclear what you mean. Are there other CSS pre-processors that don't rely on Ruby? Yes. Is there a way to compile Sass without Ruby? Depends. We need more background. Commented Sep 29, 2012 at 22:31
  • But you don't specify which language you would prefer the parser to be written into. Commented Apr 19, 2013 at 22:49
  • 1
    Is there a way of downloading a pre-compiled version?
    – William
    Commented Mar 16, 2014 at 7:42

8 Answers 8

53

Sass was originally written for Ruby, but now they've created libSass which is a C/C++ port of the Sass engine, which makes it easier to integrate the engine into an IDE or another language. At this point, you can use the Sass engine in Ruby, Node.js, Python, PHP, Java, .NET and others. For more information, visit libSass. Also, your IDE might have a plugin which would support Sass, without the need of ruby by using the libSass.

The original answer below may or may not apply to your situation (depends on whether or not your language has implemented support for libSass or not). I decided to leave it the way it is for archive reasons.


Sass (requires Ruby)

Sass is written in Ruby, so you’ll need Ruby installed as well. Taken from sass's site

Compass (requires Ruby, as it's based on SASS)

Compass is an open-source CSS authoring framework which uses the Sass stylesheet language to make writing stylesheets powerful and easy. Taken from compass's site

Less (written in js, requires node.js or less.js included in the page)

LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. LESS runs on both the client-side (Chrome, Safari, Firefox) and server-side, with Node.js and Rhino. Taken from Less's site

These are the main processors out there that I know of. You may write your own parser/port for any another language of choice.

In other words, no you can't use sass/compass without having Ruby because the program itself (sass & compass) IS written in Ruby. So you'll definitely need it in order to run it.

3
  • This is technically accurate but not really to the point as various plugins can take care of it for you. For example in Visual Studio there is the Mindscape Workbench plugin that has a self-contained ruby environment that you won't have to worry about. It will not include compass for you however which is kind of a downer. Commented Oct 23, 2012 at 18:46
  • No, I haven't tried finding similar compilers in other languages. You should be able to write a compile from scratch in pretty much any decent language but that will most probably take you a lot of time. First you'll have to be able to parse the css (and detect any errors in the css syntax) and then you'll have to "compile" (which is mostly reformatting - i.e. the css code is one line) the css. After that you'll most probably want to add multiple css with inheritance. If you feel you have the time, you can try doing it and share the result with us :)
    – tftd
    Commented Apr 20, 2013 at 14:03
  • 1
    LESS is also possible natively in .NET using the dotLESS NuGet package. Commented Oct 8, 2013 at 15:17
27

It's true that the question is not clear enough, but i'll try to address some issues. There are other CSS pre-processors that don't rely on Ruby (two coming to my mind right now are Less, which i've used and liked, but not as powerful as Sass, and Stylus, which i haven't used, both based on JavaScript), but as you're specifically asking about Sass+Compass, and as i'm still looking for the same answer, i'll talk about that.

@JamundFerguson said:

Is there a way to compile Sass without Ruby? Depends.

There is

Sass is a pre-processing language. There's a compiler built in Ruby for it and anyone can write a compiler in any language. There's a C implementation of a Sass compiler called libsass which can be used on any language that allows to import C libs. It's the library used by node-sass, which is a compiler built in Node.js, which I didn't tried yet and don't know how it could work and if it's ready for production use. It may be a question of time for Compass to be ported (maybe you end up doing that?) and so we can have a compiler which doesn't depends on the Ruby gem (currently, there's a node-compass module that does relies on the Ruby gem).

Other languages

So far i've mentioned the possibility for a Node.js compiler, which, as you may know, it's a JavaScript environment, being the language of the web and my language of choice. But you didn't specified which language you would like the compiler to be written into. I think there may be compilers built in many languages, for example, @EricMeyer mentioned a Python compiler. Maybe he's using pyScss? That seems to have built-in support for Compass. But then you need a Python environment. So the thing is: you'll need some environment for a compiler unless you run natively compiled binaries. (Less has less.js which can be included on the page to run client-side and avoid the compiling step, but it's not meant for using it on production.)

Native apps

I've worked for a year with CodeKit, which does very well, compiles Sass/Compass, Less, Stylus and template languages like Haml, Slim, Jade, etc. Rebuilds your assets when they change automatically and you see the changed on your browser immediately. The only thing that i didn't liked was that when moving to a different computer, installing CodeKit, checking out project and trying to use it, i had to reconfigure the project settings, which i had to remember so i could get to a build like the one i made in the other computer. Also i started working with a team, and they had also to configure the project with the same settings (sometimes not having the same project config lead to ugly inconsistencies) and also members of the team using Ubuntu couldn't use it. That's why i started to think on making a command-line tool to build projects and discovered Grunt immediately, and fell in love with it. As @Dave mentioned, there's Scout and also there's LiveReload, but haven't used them.

Conclusion

Conclusion is i have not a strong conclusion. I'm still looking for the same answer, but i hope this answer sheds a little bit of light on the status of compiling Sass/Compass outside of the Ruby environment.

1
27

Actually there is a library that provides binding for Node.js to libsass, the C version of the Sass: https://npmjs.org/package/node-sass

It allows you to natively compile .scss files to css at incredible speed without Ruby installed.

To install just run:

npm install node-sass

And there is also a Grunt extension if needed: https://github.com/sindresorhus/grunt-sass (this is what I've been looking for in this question)

Find out more at: https://github.com/andrew/node-sass

1
  • 1
    grunt-sass was what I was looking for.
    – user5479362
    Commented Mar 2, 2017 at 8:58
11

Just a little bit of an update on this, you can use SCSS/SASS files and generate the correct files on the fly without installing Ruby by using a program called Scout.

Scout has its own self contained ruby environment and is coded in java so make sure you java is up to date before using. Linky here.

Regards :)

3
  • 9
    I'd rather ruby over java ;)
    – basarat
    Commented Aug 3, 2013 at 4:20
  • Actually at the moment I write this Scout uses Adobe Air. Maybe an old version used Java?
    – iconoclast
    Commented Dec 5, 2013 at 23:11
  • 3
    still ruby better than Air :)
    – user3348051
    Commented Nov 10, 2015 at 21:31
4

You can actually parse sass without ruby, you can use node-sass. details here: https://github.com/andrew/node-sass

2

If this is for .NET, there is now a wrapper for libsass. Available from Nuget.

2

Adobe Brackets (free, open source) can compile LESS, SASS and Stylus when the files are changed, and update styles during live preview, you just need to install required extensions from the extension manager. Get Brackets and enjoy !

Edit: As other questions suggest node-sass is also a good option if you have nodejs already installed.

0

macOS users can install Dart Sass by running:

$ brew install sass/sass/sass

Windows users can install Dart Sass by running:

$ choco install sass

More info: https://github.com/sass/dart-sass

Not the answer you're looking for? Browse other questions tagged or ask your own question.