Coder Social home page Coder Social logo

sassc-rails's Introduction

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

sassc-rails's People

Contributors

bolandrm avatar schneems avatar rafaelfranca avatar jhawthorn avatar johantell avatar henrik avatar byroot avatar nschonni avatar boffbowsh avatar readmecritic avatar rosenfeld avatar dreyks avatar samjewell avatar ykzts avatar ferdinandrosario avatar kinopyo avatar

Watchers

Gleb Mazovetskiy avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.