3Using Sass with Rails

Sass was originally built to work with Rails, and it’s painfully easy to use with the popular Ruby web framework. If you don’t use Rails, then move on to the next chapter, where we’ll show you an easy way to work with Sass files on your computer. The only difficult part is dealing with the slight differences between Rails versions. But read on, brave reader, and we’ll get you sorted out.

If you are using a Rails version previous to 3.0, then all you need to do to get Sass working with your Rails application is to add config.gem ’sass’ to your environment.rb file. If you place your Sass files inside of public/stylesheets/sass/ (yes, make sure to make the directory!), then they will automatically get compiled to CSS in ...

Get Pragmatic Guide to Sass now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.