Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing sassc with dartsass-sprockets #92

Merged
merged 5 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ gemspec
gem 'rails'
gem 'i18n-tasks'

# For development; when running as a library, you can pick your own sass compiler
gem 'dartsass-sprockets'

eval_gemfile './shared.gemfile'
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Add [![Gem Version][gem-badge]][gem] to Gemfile:
gem 'rails_email_preview', '~> 2.2.3'
```

This gem requires a Sass engine, please ensure you have **one** of these gems in your Gemfile:
jonmchan marked this conversation as resolved.
Show resolved Hide resolved
- [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+
- [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft
- [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine
- [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4

Add an initializer and the routes:

```console
Expand Down
20 changes: 19 additions & 1 deletion lib/rails_email_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@
require 'rails_email_preview/delivery_handler'
require 'rails_email_preview/view_hooks'

require 'sassc-rails'
# sass engine loader
begin
require 'dartsass-sprockets'
rescue LoadError
begin
require 'sassc-rails'
rescue LoadError
begin
require 'dartsass-rails'
rescue LoadError
begin
require 'cssbundling-rails'
rescue LoadError
raise LoadError.new("bootstrap-rubygem requires a Sass engine. Please add dartsass-sprockets, sassc-rails, dartsass-rails or cssbundling-rails to your dependencies.")
jonmchan marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
end

require 'request_store'
require 'turbolinks'
require 'pathname'
Expand Down
1 change: 0 additions & 1 deletion rails_email_preview.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Gem::Specification.new do |s|
end

s.add_dependency 'rails', '>= 4.2'
jonmchan marked this conversation as resolved.
Show resolved Hide resolved
s.add_dependency 'sassc-rails', '>= 2.0.0'
s.add_dependency 'turbolinks'
s.add_dependency 'request_store'

Expand Down
Loading