Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Wrap SassC/Sass gems #108
This is in response to a bug which was pointed out in
In order to resolve this, I'm opting to wrap both
Code coverage goes down due to
require 'sassc' ::SassC rescue LoadError => exception begin require 'sass' ::Sass rescue LoadError raise exception end
Not sure how to account for the case where
@landongrindheim Thanks for this PR.
Did you also try to manage the loading of SASS via Tilt? If so, why did you pick this way and not the other?
NOTE: I'm not suggesting you to do so, just suggesting to explore all the options on the table.
If we decide to adopt this approach, we should port the other compilers with the same approach: wrap into an engine.
@jodosha I chose to go this route because
I suppose I chose this method in order to preserve the dependency caching done when the compiler uses
@landongrindheim Sorry for the back and forth on this.
Given the engine idea was born to abstract
Please have a look at this diff:
diff --git a/lib/hanami/assets/compilers/sass.rb b/lib/hanami/assets/compilers/sass.rb index 28cc0ed..3e0f92e 100644 --- a/lib/hanami/assets/compilers/sass.rb +++ b/lib/hanami/assets/compilers/sass.rb @@ -1,5 +1,3 @@ -require 'hanami/assets/sass/engine' - module Hanami module Assets module Compilers @@ -18,13 +16,20 @@ module Hanami name.to_s =~ EXTENSIONS end + # @since 1.3.3 + # @api private + def initialize(*args) + super + require "sassc" + end + private # @since 0.3.0 # @api private def renderer @renderer ||= - Hanami::Assets::Sass::Engine.new( + ::SassC::Engine.new( source.read, syntax: target_syntax, load_paths: load_paths @@ -34,7 +39,9 @@ module Hanami # @since 0.3.0 # @api private def dependencies - renderer.dependencies + renderer.dependencies.map(&:filename) + rescue ::SassC::NotRenderedError +  end # @since 1.3.2
The compiler dynamically loads
If it doesn't blow up at the initialize time, it's safe to refer to
That makes both Sass and Less engines obsolete. Sorry again.
Would you like to take care of this? What's the best way to get in touch with you? Thanks.
@jodosha I'm glad you were able to look at this from that perspective. Without supporting both
I'm reachable by