Module: Pakyow::Assets::Types::Sass::Behavior
- Extended by:
- Support::Extension
- Included in:
- Pakyow::Assets::Types::Sass, Pakyow::Assets::Types::Scss
- Defined in:
- lib/pakyow/assets/types/sass.rb
Instance Method Summary collapse
- #dependencies ⇒ Object
- #initialize(local_path:, config:, **kwargs) ⇒ Object
- #process(content) ⇒ Object
- #source_map_content ⇒ Object
Instance Method Details
#dependencies ⇒ Object
46 47 48 49 50 51 |
# File 'lib/pakyow/assets/types/sass.rb', line 46 def dependencies ensure_content @engine.dependencies.map { |dependency| dependency.[:filename] } end |
#initialize(local_path:, config:, **kwargs) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pakyow/assets/types/sass.rb', line 18 def initialize(local_path:, config:, **kwargs) super @options = @config.sass.to_h @options[:load_paths] ||= [] @options[:load_paths].unshift(File.dirname(@local_path)) @options[:filename] = @local_path.to_s # Set the syntax dynamically based on whether we're in Sass or Scss class. # @options[:syntax] = self.class.const_get("FORMAT") if @config.source_maps @options[:source_map_file] = File.basename(@local_path.to_s) end end |
#process(content) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pakyow/assets/types/sass.rb', line 35 def process(content) @engine = ::SassC::Engine.new(content, @options) @engine.render rescue StandardError => error Pakyow.logger.error "[#{self.class}] #{error}" # Be sure to return a string. # content end |
#source_map_content ⇒ Object
53 54 55 56 |
# File 'lib/pakyow/assets/types/sass.rb', line 53 def source_map_content ensure_content @engine.source_map end |