Sha256: 22dc62cbede655a283c763b49246f9cca9ab39d6e64a148dc3290a8479534fa0
Contents?: true
Size: 803 Bytes
Versions: 12
Compression:
Stored size: 803 Bytes
Contents
include_set Abstract::Scss include_set Abstract::AssetInputter, input_format: :scss event :validate_scss_syntax, :validate, on: :save, changed: %i[type_id content] do variables = Card[:all, :style]&.joined_items_content return unless variables.present? # happens during card:seed:build SassC::Engine.new([variables.strip, content].join("\n")).render rescue SassC::SyntaxError => e match = e.message.match(/line (\d+)/) message = if match offset = 6 corrected_line = match[1].to_i - variables.lines.count + offset e.message .sub(/line \d+:(\d+) of stdin/, "line #{corrected_line}:\\1") .sub(/>>.*$/, ">> #{content.lines[corrected_line - 1]}") # e.message else e.message end errors.add(:content, "<pre>#{message}</pre>".html_safe) end
Version data entries
12 entries across 12 versions & 1 rubygems