module Pakyow::Assets::Types::Sass::Behavior
Public Class Methods
new(local_path:, config:, **kwargs)
click to toggle source
Calls superclass method
# 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
Public Instance Methods
dependencies()
click to toggle source
# File lib/pakyow/assets/types/sass.rb, line 46 def dependencies ensure_content @engine.dependencies.map { |dependency| dependency.options[:filename] } end
process(content)
click to toggle source
# 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()
click to toggle source
# File lib/pakyow/assets/types/sass.rb, line 53 def source_map_content ensure_content @engine.source_map end