From 26338cb47dff54d16639901bbbae12d7b4852de9 Mon Sep 17 00:00:00 2001 From: Matt Menefee Date: Tue, 13 Feb 2024 18:11:13 -0700 Subject: [PATCH] Support other Sass processors This softens the "sassc" dependency in order to allow for Dart Sass to be used, since Ruby Sass has been deprecated. --- font-awesome-sass.gemspec | 2 -- lib/font-awesome-sass.rb | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/font-awesome-sass.gemspec b/font-awesome-sass.gemspec index 756add5..641c5a5 100644 --- a/font-awesome-sass.gemspec +++ b/font-awesome-sass.gemspec @@ -18,8 +18,6 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] - spec.add_runtime_dependency 'sassc', '~> 2.0' - spec.add_development_dependency 'bundler', '>= 1.3' spec.add_development_dependency 'rake' end diff --git a/lib/font-awesome-sass.rb b/lib/font-awesome-sass.rb index a44186a..42015e4 100644 --- a/lib/font-awesome-sass.rb +++ b/lib/font-awesome-sass.rb @@ -1,3 +1,17 @@ +begin + require 'sassc' +rescue LoadError + begin + require 'sassc-embedded' + rescue LoadError + begin + require 'sass-embedded' + rescue LoadError + raise LoadError.new('font-awesome-sass-rubygem requires a Sass engine. Please add dartsass-sprockets, sassc-rails, dartsass-rails or cssbundling-rails to your dependencies.') + end + end +end + module FontAwesome module Sass class << self