Sha256: 5d9e3ac7e3cb1f23af7dd732e1641d8ee5881d2fe21252176e0092d7069c6062

Contents?: true

Size: 565 Bytes

Versions: 10

Compression:

Stored size: 565 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
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scss-lint-0.6.7 lib/scss_lint/engine.rb
scss-lint-0.6.6 lib/scss_lint/engine.rb
scss-lint-0.6.5 lib/scss_lint/engine.rb
scss-lint-0.6 lib/scss_lint/engine.rb
scss-lint-0.5.2 lib/scss_lint/engine.rb
scss-lint-0.5 lib/scss_lint/engine.rb
scss-lint-0.4 lib/scss_lint/engine.rb
scss-lint-0.3 lib/scss_lint/engine.rb
scss-lint-0.2 lib/scss_lint/engine.rb
scss-lint-0.1 lib/scss_lint/engine.rb