A summary of data about the Ruby ecosystem.

https://github.com/rails/sass-rails

Ruby on Rails stylesheet engine for Sass
https://github.com/rails/sass-rails

Keywords from Contributors

activerecord activejob mvc rubygems rack sinatra devise rspec background-jobs authorization

Last synced: 15 minutes ago
JSON representation

Repository metadata

Ruby on Rails stylesheet engine for Sass

README.md

Official Ruby-on-Rails Integration with Sass

This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language.

Installing

Since Rails 3.1, new Rails projects will be already configured to use Sass. If you are upgrading to Rails 3.1 you will need to add the following to your Gemfile:

gem 'sass-rails'

Configuration

To configure Sass via Rails set use config.sass in your
application and/or environment files to set configuration
properties that will be passed to Sass.

Options

  • preferred_syntax - This option determines the default Sass syntax and file extensions that will be used by Rails generators. Can be :scss (default CSS-compatible SCSS syntax) or :sass (indented Sass syntax).

The list of supported Sass options
can be found on the Sass Website with the following caveats:

  • :style - This option is not supported. This is determined by the Rails environment. It's :expanded only on development, otherwise it's :compressed.
  • :never_update - This option is not supported. Instead set config.assets.enabled = false
  • :always_update - This option is not supported. Sprockets uses a controller to access stylesheets in development mode instead of a full scan for changed files.
  • :always_check - This option is not supported. Sprockets always checks in development.
  • :syntax - This is determined by the file's extensions.
  • :filename - This is determined by the file's name.
  • :line - This is provided by the template handler.

Example

MyProject::Application.configure do
  config.sass.preferred_syntax = :sass
  config.sass.line_comments = false
  config.sass.cache = false
end

Important Note

Sprockets provides some directives that are placed inside of comments called require, require_tree, and
require_self. DO NOT USE THEM IN YOUR SASS/SCSS FILES. They are very
primitive and do not work well with Sass files. Instead, use Sass's native @import directive which
sass-rails has customized to integrate with the conventions of your Rails projects.

Features

Glob Imports

When in Rails, there is a special import syntax that allows you to
glob imports relative to the folder of the stylesheet that is doing the importing.

  • @import "mixins/*" will import all the files in the mixins folder
  • @import "mixins/**/*" will import all the files in the mixins tree

Any valid ruby glob may be used. The imports are sorted alphabetically.

NOTE: It is recommended that you only use this when importing pure library
files (containing mixins and variables) because it is difficult to control the
cascade ordering for imports that contain styles using this approach.

Asset Helpers

When using the asset pipeline, paths to assets must be rewritten.
When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
in Sass):

asset-path($relative-asset-path)

Returns a string to the asset.

  • asset-path("rails.png") returns "/assets/rails.png"

asset-url($relative-asset-path)

Returns a url reference to the asset.

  • asset-url("rails.png") returns url(/assets/rails.png)

As a convenience, for each of the following asset classes there are
corresponding -path and -url helpers:
image, font, video, audio, javascript, stylesheet.

  • image-path("rails.png") returns "/assets/rails.png"
  • image-url("rails.png") returns url(/assets/rails.png)

asset-data-url($relative-asset-path)

Returns a url reference to the Base64-encoded asset at the specified path.

  • asset-data-url("rails.png") returns url(data:image/png;base64,iVBORw0K...)

Running Tests

$ bundle install
$ bundle exec rake test

If you need to test against local gems, use Bundler's gem :path option in the Gemfile and also edit test/support/test_helper.rb and tell the tests where the gem is checked out.

Code Status

  • Travis CI
  • Gem Version

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 8 days ago

Total Commits: 421
Total Committers: 66
Avg Commits per committer: 6.379
Development Distribution Score (DDS): 0.81

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Chris Eppstein c****s@e****t 80
Joshua Peek j****h@j****m 61
Francesco Rodriguez l****c@g****m 56
Rafael Mendonça França r****a@p****r 54
Arthur Neves a****n@g****m 14
Santiago Pastorino s****o@w****m 14
Guillermo Iguaran g****n@g****m 13
Rafael Mendonça França r****a@g****m 11
José Valim j****m@g****m 11
Jon Leighton j@j****m 11
yuuji.yaginuma y****a@g****m 8
Jeremy Kemper j****y@b****t 6
Robin Dupret r****t@g****m 5
Joe Noon j****n@g****m 4
robertomiranda r****r@g****m 3
Yuri S. F****i 3
Tee Parham t****e@n****m 3
Andrei Istratii a****i@g****m 3
Richard Schneeman r****n@g****m 2
Aaron Patterson a****n@g****m 2
Andreas Lietz a****z 2
Carlos Antonio da Silva c****a@g****m 2
Craig Israel c****g@t****t 2
David Heinemeier Hansson d****d@l****m 2
Grzesiek Kolodziejczyk g****k@g****m 2
Justin Smestad j****d@g****m 2
Kentaro Kuribayashi k****k@g****m 2
Olivier Lacan hi@o****m 2
Takashi Kokubun t****n@g****m 2
wycats w****s@g****m 2
and 36 more...

Committer domains:


Issue and Pull Request metadata

Last synced: about 2 months ago

Total issues: 81
Total pull requests: 20
Average time to close issues: almost 2 years
Average time to close pull requests: about 1 year
Total issue authors: 79
Total pull request authors: 16
Average comments per issue: 5.0
Average comments per pull request: 2.95
Merged pull request: 7
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/rails/sass-rails

Top Issue Authors

  • jonhue (2)
  • wjordan (2)
  • davidpatters0n (1)
  • o-t-w (1)
  • itay-grudev (1)
  • jmarchello (1)
  • dsandstrom (1)
  • tricknotes (1)
  • leomao10 (1)
  • bruz (1)
  • gleydsonst (1)
  • PQALAB (1)
  • djmtype (1)
  • KKSun (1)
  • reckerswartz (1)

Top Pull Request Authors

  • y-yagi (3)
  • HarlemSquirrel (2)
  • wjordan (2)
  • leandro (1)
  • gssbzn (1)
  • guilleiguaran (1)
  • richpeck (1)
  • Hamms (1)
  • jacobbednarz (1)
  • orien (1)
  • samdemaeyer (1)
  • ruipserra (1)
  • bolandrm (1)
  • gregmolnar (1)
  • lucasmazza (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: sass-rails

Sass adapter for the Rails asset pipeline.

rubygems.org: sass-rails

Sass adapter for the Rails asset pipeline.

proxy.golang.org: github.com/rails/sass-rails

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/rails/sass-rails#section-documentation
  • Licenses: mit
  • Latest release: v6.0.0+incompatible (published over 6 years ago)
  • Last Synced: 2025-12-07T18:01:53.695Z (5 days ago)
  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Forks count: 1.548%
    • Stargazers count: 2.144%
    • Average: 6.017%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%

Dependencies

sass-rails.gemspec rubygems
  • sassc-rails ~> 2.1, >= 2.1.1

Score: 31.384686296741386