Class: Hanami::Assets::Compressors::SassStylesheet Private
- Inherits:
-
Stylesheet
- Object
- Abstract
- Stylesheet
- Hanami::Assets::Compressors::SassStylesheet
- Defined in:
- lib/hanami/assets/compressors/sass_stylesheet.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Sass compressor for stylesheet
It depends on sass
gem.
Constant Summary collapse
- SASS_CACHE_LOCATION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
FIXME This is the same logic that we have for Hanami::Assets::Compiler
Pathname(Hanami.respond_to?(:root) ? # rubocop:disable Style/MultilineTernaryOperator Hanami.root : Dir.pwd).join('tmp', 'sass-cache')
Instance Method Summary collapse
- #compress(filename) ⇒ Object private
-
#initialize ⇒ SassStylesheet
constructor
private
A new instance of SassStylesheet.
Methods inherited from Stylesheet
Constructor Details
#initialize ⇒ SassStylesheet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SassStylesheet.
25 26 27 |
# File 'lib/hanami/assets/compressors/sass_stylesheet.rb', line 25 def initialize @compressor = Sass::Engine end |
Instance Method Details
#compress(filename) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 |
# File 'lib/hanami/assets/compressors/sass_stylesheet.rb', line 31 def compress(filename) compressor.new(read(filename), filename: filename, syntax: :scss, style: :compressed, cache_location: SASS_CACHE_LOCATION).render end |