File: compressor.rb

package info (click to toggle)
ruby-sassc-rails 2.1.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 428 kB
  • sloc: ruby: 628; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

require 'sprockets/sass_compressor'
require 'securerandom'

class Sprockets::SassCompressor
  def initialize(options = {})
    @options = {
      syntax: :scss,
      cache: false,
      read_cache: false,
      style: :compressed
    }.merge(options).freeze
    @cache_key = SecureRandom.uuid
  end

  def call(*args)
    input = if defined?(data)
      data # sprockets 2.x
    else
      args[0][:data] #sprockets 3.x
    end

    SassC::Engine.new(
      input,
      {
        style: :compressed
      }
    ).render
  end

  # sprockets 2.x
  alias :evaluate :call
end