• Stars
    star
    705
  • Rank 61,959 (Top 2 %)
  • Language
    HTML
  • License
    MIT License
  • Created about 9 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Integrate SassC-Ruby with Rails!

SassC::Rails Build Status Gem Version

We all love working with Sass, but compilation can take quite a long time for larger codebases. This gem integrates the C implementation of Sass, LibSass, into the asset pipeline.

In one larger project, this made compilation 4x faster:

# Using sassc-rails

[1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
       user     system      total        real
   1.720000   0.170000   1.890000 (  1.936867)

# Using sass-rails

 [1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
       user     system      total        real
  7.820000   0.250000   8.070000 (  8.106347)

This should essentially be a drop in alternative to sass-rails.

Inline Source Maps

With SassC-Rails, it's also extremely easy to turn on inline source maps. Simply add the following configuration to your development.rb file:

# config/environments/development.rb
config.sass.inline_source_maps = true

After adding this config line, you may need to clear your assets cache (rm -r tmp/cache/assets), stop spring, and restart your rails server. You may also wish to disable line comments (config.sass.line_comments = false).

Note, as indicated, these source maps are inline. They will not generate additional files or anything like that. Instead, they will be appended to the compiled application.css file.

LibSass Compatibility With Ruby Sass

For a look at the compatibility between Ruby Sass and LibSass, check this compatibility chart out.

Installation

Add this line to your application's Gemfile:

gem 'sassc-rails'

And then execute:

$ bundle

Common Issues

Deployment to Heroku

Due to LibSass compilation requirements, you must upgrade to the Heroku Cedar-14 Stack in order to successfully install this gem.

Upgrading to Cedar-14 is usually a painless process.

Installing alongside a gem that depends on Sass-Rails

Libraries explicitly depending on Sass-Rails, such as ActiveAdmin, can cause conflicts with installation of SassC-Rails. While we have no built-in solution for this, please check out this issue for a workaround.

Credits

This gem is based on sass-rails, and is maintained by Ryan Boland and awesome contributors.

Changelog

Contributing

  1. Fork it ( https://github.com/sass/sassc-rails/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Add Tests
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

More Repositories

1

sass

Sass makes CSS fun!
TypeScript
14,889
star
2

node-sass

🌈 Node.js bindings to libsass
C++
8,477
star
3

libsass

A C/C++ implementation of a Sass compiler
C++
4,312
star
4

dart-sass

The reference implementation of Sass, written in Dart.
Dart
3,784
star
5

sassc

libsass command line driver
C
778
star
6

libsass-python

A straightforward binding of libsass for Python. Compile Sass/SCSS in Python with no Ruby stack at all!
Python
551
star
7

sassc-ruby

Use libsass with Ruby!
Ruby
365
star
8

sass-site

Sass Website
TypeScript
298
star
9

node-sass-middleware

connect middleware extracted from node-sass
JavaScript
263
star
10

sass-spec

Official Sass Spec Suite
SCSS
198
star
11

ruby-sass

The original, now deprecated Ruby implementation of Sass
Ruby
182
star
12

embedded-host-node

A Node.js library that will communicate with Embedded Dart Sass using the Embedded Sass protocol
TypeScript
129
star
13

node-sass-binaries

Platform specific binaries for node-sass
127
star
14

libsass-net

A lightweight wrapper around libsass
C#
94
star
15

migrator

Tool for migrating stylesheets to new Sass versions
Dart
83
star
16

ruby-libsass

Ruby bindings for libsass
Ruby
81
star
17

dart-sass-embedded

A wrapper for Dart Sass that implements the compiler side of the Embedded Sass protocol
Dart
67
star
18

linter

An experimental Sass linter written using the Dart Sass AST
Dart
39
star
19

embedded-protocol

A protocol for communicating between a Sass implementation and a host language
33
star
20

homebrew-sass

A Homebrew tap for Sass
Ruby
33
star
21

perl-libsass

Perl bindings for libsass (CSS::Sass)
Perl
27
star
22

libsass.com

CSS
6
star
23

sass-registry

Extension registry for Sass
Ruby
6
star
24

sass-site-built

The built HTML of the Sass website, used to see output diffs in code reviews
HTML
5
star
25

clone-linked-repo

A utility action that emits information about one PR linked from another's message
Shell
2
star