Sha256: 8c1c4659e6205e8ea2a6a35c1edd991439274ea6eede46f5f632970303b54ae7

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

require 'sass'

module SCSSLint
  class Engine
    ENGINE_OPTIONS = { cache: false, syntax: :scss }

    attr_reader :contents, :lines, :tree

    def initialize(scss_or_filename)
      if File.exists?(scss_or_filename)
        @engine = Sass::Engine.for_file(scss_or_filename, ENGINE_OPTIONS)
        @contents = File.open(scss_or_filename, 'r').read
      else
        @engine = Sass::Engine.new(scss_or_filename, ENGINE_OPTIONS)
        @contents = scss_or_filename
      end

      @lines = @contents.split("\n")
      @tree = @engine.to_tree
      #@tree, _ = Sass::Tree::Visitors::Perform.visit(@tree)

      Sass::CSS.dump_selectors(@tree)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.5.1 lib/scss_lint/engine.rb