Skip to content

Commit

Permalink
Remove 'cache_location' option, since sassc doesn't use it
Browse files Browse the repository at this point in the history
It's not in the Ruby gem and it's also not in libsass.

See: sass/libsass#2879
  • Loading branch information
cllns committed Jul 26, 2019
1 parent 7d75c62 commit 5b72f02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
8 changes: 1 addition & 7 deletions lib/hanami/assets/compilers/sass.rb
Expand Up @@ -10,11 +10,6 @@ class Sass < Compiler
# @api private
EXTENSIONS = /\.(sass|scss)\z/.freeze

# @since 0.1.0
# @api private
CACHE_LOCATION = Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator
Hanami.root : Dir.pwd).join('tmp', 'sass-cache')

# @since 0.3.0
# @api private
def self.eligible?(name)
Expand All @@ -26,7 +21,7 @@ def self.eligible?(name)
# @since 0.3.0
# @api private
def renderer
Tilt.new(source, nil, load_paths: load_paths, cache_location: CACHE_LOCATION)
Tilt.new(source, nil, load_paths: load_paths)
end

# @since 0.3.0
Expand All @@ -43,7 +38,6 @@ def engine
::SassC::Engine.new(
to_be_compiled,
load_paths: load_paths,
cache_location: CACHE_LOCATION,
syntax: (:sass if ::File.extname(source.to_s) == ".sass")
)
end
Expand Down
10 changes: 2 additions & 8 deletions lib/hanami/assets/compressors/sass_stylesheet.rb
Expand Up @@ -6,7 +6,7 @@ module Assets
module Compressors
# Sass compressor for stylesheet
#
# It depends on <tt>sass</tt> gem.
# It depends on <tt>sassc</tt> gem.
#
# @since 0.1.0
# @api private
Expand All @@ -16,12 +16,6 @@ module Compressors
class SassStylesheet < Stylesheet
# @since 0.1.0
# @api private
#
# FIXME This is the same logic that we have for Hanami::Assets::Compiler
SASS_CACHE_LOCATION = Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator
Hanami.root : Dir.pwd).join('tmp', 'sass-cache')
# @since 0.1.0
# @api private
def initialize
@compressor = SassC::Engine
end
Expand All @@ -30,7 +24,7 @@ def initialize
# @api private
def compress(filename)
compressor.new(read(filename), filename: filename, syntax: :scss,
style: :compressed, cache_location: SASS_CACHE_LOCATION).render
style: :compressed).render
end
end
end
Expand Down
9 changes: 0 additions & 9 deletions spec/integration/hanami/assets/compiler_spec.rb
Expand Up @@ -208,15 +208,6 @@
expect(target.read).to match %(body {\n font: 100% Helvetica, sans-serif;\n color: #fff; }\n)
end

it 'uses defined sass cache directory' do
directory = Pathname.new(Dir.pwd).join('tmp', 'sass-cache')
directory.rmtree if directory.exist?

Hanami::Assets::Compiler.compile(@config, 'compile-sass.css')

expect(directory.exist?).to eq(true)
end

it 'compiles scss asset if direct dependency has changed' do
dependency = TestFile.new(path: '_background.scss') do
write 'body { background-color: purple; }'
Expand Down

0 comments on commit 5b72f02

Please sign in to comment.