tablecheck / dartsass-sprockets

Integrate Dart Sass with Sprockets (Ruby on Rails asset pipeline)
MIT License
35 stars 5 forks source link

Dart Sass for Spockets

build gem

Use Dart Sass with Sprockets and the Ruby on Rails asset pipeline.

This gem is a fork of sass/sassc-rails which maintains API compatibility but delegates to the sass-embedded gem which uses Dart Sass instead of the libsass C implmentation.

For ease of upgrading, the root namespace ::SassC is still used by this gem, although it is now a misnomer. This is planned to be renamed in a future major version release.

Installation

Add this line to your application's Gemfile:

gem 'dartsass-sprockets'

This will automatically configure your default Rails config.assets.css_compressor to use :sass.

Version Support

The current version of dartsass-sprockets supports:

For older versions of Ruby and Rails may be supported with earlier versions of this gem.

Upgrading to Dart Sass

This gem is a drop-in replacement to sass-rails. Note the following differences:

Inline Source Maps

To turn on inline source maps, 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.

Note these source maps are inline and will be appended to the compiled application.css file. (They will not generate additional files.)

Alternatives

Credits

Contributing

  1. Fork it (https://github.com/tablecheck/dartsass-sprockets/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature') - try to include tests
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request