Skip to content

Commit

Permalink
Switch to libsass from sass-ruby even though it is deprecated
Browse files Browse the repository at this point in the history
The sass-ruby gem is even more deprecated than libsass which was
deprecated in sass/libsass#3123. The dart-sass is the reference
implementation now but there is no clear path for using it with
the asset pipeline[1] currently.

[1]: https://discuss.rubyonrails.org/t/transition-to-the-sass-npm-gem/76566/6
  • Loading branch information
pixeltrix committed Jan 29, 2021
1 parent 3285f29 commit 2c68dc0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gem 'dynamic_form'
gem 'faraday'
gem 'faraday_middleware'
gem 'net-http-persistent'
gem 'sass-rails', '~> 5.0'
gem 'sassc-rails'
gem 'textacular'
gem 'uglifier'
gem 'bcrypt'
Expand Down
21 changes: 9 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,14 @@ GEM
rspec-support (3.10.1)
rubyzip (1.3.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
scrypt (3.0.7)
ffi-compiler (>= 1.0, < 2.0)
selenium-webdriver (3.142.7)
Expand Down Expand Up @@ -448,7 +445,7 @@ DEPENDENCIES
rake
redcarpet
rspec-rails
sass-rails (~> 5.0)
sassc-rails
scrypt
shoulda-matchers
simplecov
Expand Down
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,10 @@ class Application < Rails::Application
config.generators do |generator|
generator.orm :active_record, primary_key_type: :serial
end

# Using a sass css compressor causes a scss file to be processed twice (once
# to build, once to compress) which breaks the usage of "unquote" to use
# CSS that has same function names as SCSS such as max
config.assets.css_compressor = nil
end
end
5 changes: 4 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass

# Rather than use a CSS compressor, use the SASS style to perform compression
config.sass.style = :compressed
config.sass.line_comments = false

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
Expand Down

0 comments on commit 2c68dc0

Please sign in to comment.